[英]Installing mysql2 gem
我嘗試安裝mysql 2 gem以開始構建我的Rails應用程序。 我有Rails 4.0.4和Ruby 1.9.3p545。 經過幾天的努力,我一直遇到相同的錯誤。 我嘗試再次安裝mysql 32位版本,以確保使用正確的接口安裝正確的版本,將libmysql.dll和libmysql.lib移至ruby / bin文件夾,並嘗試了其他幾種使其在線運行的方法。 他們都沒有為我工作。 以下是我所擁有的。 我將不勝感激任何允許我最終安裝mysql2 gem的幫助。
PS C:\Users\pc> gem install mysql2 --no-rdoc --no-ri -- '--with-mysql-lib="C:\Program Files\MySQL\
.6\lib\" --with-mysql-include="C:\Program Files\MySQL\MySQL Server 5.6\include\"'
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-mysql-lib=C:\Program Files\MySQL\MySQL Server 5.6\lib" --with-mys
Program Files\MySQL\MySQL Server 5.6\include"'
This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb --with-mysql-lib=C:\Program Files\MySQL\MySQL Server 5.6\lib" --wit
e=C:\Program Files\MySQL\MySQL Server 5.6\include"
checking for ruby/thread.h... no
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... 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:/Ruby193/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib=${mysql-dir}/lib
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mlib
--without-mlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-zlib
--without-zlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-socketlib
--without-socketlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-nsllib
--without-nsllib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mygcclib
--without-mygcclib
--with-mysqlclientlib
--without-mysqlclientlib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.16 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/mysql2-0.3.16/gem_make.out
我們在此處編寫了有關如何執行此操作的教程
-
您所做的事情有幾個問題:
- 路徑中不能有空格
- 您需要包括最新版本的MYSQL C連接器
這對我們有用:
- 下載最新的32位版本的MYSQL C連接器
- 安裝到沒有空格的路徑中
使用以下命令:
gem install mysql2 --platform=ruby -- '--with-mysql-dir=”C:\\mysql-connector-path”'
這應該正確安裝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.