2

このコマンドで mysql2 をインストールできるのは奇妙 $ gem install mysql2 --platform=ruby -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\include"'です。結果は次のとおりです。

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed mysql2-0.3.10
1 gem installed
Installing ri documentation for mysql2-0.3.10...
Installing RDoc documentation for mysql2-0.3.10...

しかし、私が実行しているときbundle install(どうやらインストールする必要がある宝石がたくさんあるようです)、mysql2のインストールに失敗したため、そこでbundle install停止しました。たくさんの感謝!以下は からの結果ですbundle install

Installing mysql2 (0.3.8) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.

        c:/Ruby192/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... no
checking for main() in -llibmysql... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=c:/Ruby192/bin/ruby
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-libmysqllib
        --without-libmysqllib


Gem files will remain installed in G:/Desktop/20090319-/Rails Examples/ClockingI
T/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.8 for inspection.
Results logged to G:/Desktop/20090319-/Rails Examples/ClockingIT/vendor/bundle/r
uby/1.9.1/gems/mysql2-0.3.8/ext/mysql2/gem_make.out
An error occured while installing mysql2 (0.3.8), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.8'` succeeds before bundling.
4

4 に答える 4

8

私のubuntuマシンでは、apt-get install libmysqld-dev最初に実行する必要があり、次にgem install mysql2...それは魅力のように機能しました:)

于 2012-11-04T23:28:44.673 に答える
2

バンドルの外部からmysqlをインストールしてみてください。それが機能する場合は、Gemfileからmysqlを削除してください。

 sudo gem install mysql --no-rdoc --no-ri -- 

--with-mysql-config = / usr / local / mysql / bin / mysql_config

また

apt-get install libmysqld-dev
于 2011-11-23T13:05:45.143 に答える
0

インストールしようとしているmysql2gemのバージョンには、Windowsで問題があります。

バージョンを示さずにmysql2gemをインストールしてください。

gem install mysql2
于 2011-11-23T13:21:30.643 に答える
0

問題なく動作します。バージョン mysql-connector-c-6.1.5-win32 をダウンロードし、フォルダーで解凍して、これを試してください。

私にとってはうまくいきます。

gem install mysql2 --no-ri --no-rdoc --platform=ruby -- --with-mysql-include=C:\mysql-connector\mysql-connector-c-6.1.5-win32\include -- with-mysql-lib=C:\mysql-connector\mysql-connector-c-6.1.5-win32\lib

于 2014-07-24T20:50:19.213 に答える