質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

Windows

Windowsは、マイクロソフト社が開発したオペレーティングシステムです。当初は、MS-DOSに変わるOSとして開発されました。 GUIを採用し、主にインテル系のCPUを搭載したコンピューターで動作します。Windows系OSのシェアは、90%を超えるといわれています。 パソコン用以外に、POSシステムやスマートフォンなどの携帯端末用、サーバ用のOSもあります。

Q&A

0回答

3637閲覧

windowsでのmysql2のgemインストール

TheDarkLoad

総合スコア12

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

Windows

Windowsは、マイクロソフト社が開発したオペレーティングシステムです。当初は、MS-DOSに変わるOSとして開発されました。 GUIを採用し、主にインテル系のCPUを搭載したコンピューターで動作します。Windows系OSのシェアは、90%を超えるといわれています。 パソコン用以外に、POSシステムやスマートフォンなどの携帯端末用、サーバ用のOSもあります。

0グッド

1クリップ

投稿2018/10/19 09:51

編集2018/10/19 10:04

windowsにてmysql2のgemインストールを行いたいのですがうまくいきません。

gem install mysql2

を入力すると、

================================================================================ ====================== You've installed the binary version of mysql2. It was built using MySQL Connector/C version 6.1.11. It's recommended to use the exact same version to avoid potential issues. At the time of building this gem, the necessary DLL files were retrieved from: http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-6.1.11-win32.zip This gem *includes* vendor/libmysql.dll with redistribution notice in vendor/R EADME. ================================================================================ ====================== Successfully installed mysql2-0.5.2-x64-mingw32 Parsing documentation for mysql2-0.5.2-x64-mingw32 Installing ri documentation for mysql2-0.5.2-x64-mingw32 Done installing documentation for mysql2 after 0 seconds 1 gem installed

とうまくいったように見えますが、

ridgepole -c database.yml -E development --apply --dry-run -f fuel/app/schema/config

と入力すると、

Failed to load libmysql.dll from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/mysql2-0 .5.2-x64-mingw32/vendor/libmysql.dll

とエラーが返ってきます。

なので、mysql connectorの64bit版をダウンロードして、

gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\mysql-connector\lib" --with-mysql-include="C:\mysql-connector\include"'

そのコネクタを見てmysql2をダウンロードするようにしてみたのですが、

Temporarily enhancing PATH for MSYS/MINGW... Installing required msys2 packages: mingw-w64-x86_64-libmariadbclient 警告: mingw-w64-x86_64-libmariadbclient-2.3.7-1 は最新です -- スキップ Building native extensions with: '--with-mysql-lib="C:\mysql-connector\lib" --wi th-mysql-include="C:\mysql-connector\include"' This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/mysql2-0.5.2/ext/m ysql2 C:/Ruby25-x64/bin/ruby.exe -r ./siteconf20181019-8684-1kf2yyq.rb extconf.rb --wi th-mysql-lib="C:\mysql-connector\lib" --with-mysql-include="C:\mysql-connector\i nclude" checking for rb_absint_size()... yes checking for rb_absint_singlebit_p()... yes checking for rb_wait_for_single_fd()... yes ----- Using --with-mysql-dir=C:\mysql-connector ----- checking for -lmysqlclient... yes checking for mysql.h... yes checking for errmsg.h... yes checking for SSL_MODE_DISABLED in mysql.h... yes checking for SSL_MODE_PREFERRED in mysql.h... yes checking for SSL_MODE_REQUIRED in mysql.h... yes checking for SSL_MODE_VERIFY_CA in mysql.h... yes checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes checking for MYSQL.net.vio in mysql.h... yes checking for MYSQL.net.pvio in mysql.h... no checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes checking for SERVER_QUERY_WAS_SLOW in mysql.h... yes checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes checking for my_bool in mysql.h... yes creating Makefile current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/mysql2-0.5.2/ext/mysql 2 make "DESTDIR=" clean current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/mysql2-0.5.2/ext/mysql 2 make "DESTDIR=" generating mysql2-x64-mingw32.def compiling client.c compiling infile.c compiling mysql2_ext.c compiling result.c compiling statement.c linking shared-object mysql2/mysql2.so client.o:client.c:(.text+0x2a9): undefined reference to `mysql_options4' collect2.exe: error: ld returned 1 exit status make: *** [Makefile:259: mysql2.so] 繧ィ繝ゥ繝シ 1 make failed, exit code 2 Gem files will remain installed in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/mysql2 -0.5.2 for inspection. Results logged to C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0 /mysql2-0.5.2/gem_make.out

という結果が返ってきて、mysql2のインストールに失敗します。

どなたか解決策はございませんでしょうか。
やっぱりmacでないと動かないのでしょうか。

よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問