安装 Mysql2 -v '0.3.14' 用于轨道 4 错误



我需要一些帮助来安装 Mysql2 -v '0.3.14' 在 Windows 4 上为 rails 7

总是在运行命令'gem install mysql2 -v '0.3.14'

之后

我总是收到错误

c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
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:/RailsInstaller/Ruby1.9.3/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-mysql-config
    --without-mysql-config
    --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-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

注意:当我安装 mysql2 -v 0.2.6 时,它与我一起安装得很好但我不知道为什么我在 v 0.3.14 上收到此错误

我如何解决这个问题?

另外,当我尝试使用命令安装它时

gem install mysql --platform=ruby -- --with-mysql-include=C:\mysql-connector-c-noinstall-6.0.2-win32\include --

with-mysql-lib=C:\mysql-connector-c-noinstall-6.0.2-win32\lib

我收到错误

c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-mysql-include=c:mysql-connector-c-noinstall-6.0.2-win32include --with-mysql-lib=mysql-connector-c-noinstall-6.0.2-win32lib
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:/RailsInstaller/Ruby1.9.3/bin/ruby
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include=${mysql-dir}/include
    --with-mysql-lib=${mysql-dir}/lib
    --with-libmysqllib
    --without-libmysqllib

1-首先从此页面下载 mysql-connector-c-6.1.3-win32

http://dev.mysql.com/downloads/connector/c/

注意:下载ZIP存档文件

2-解压缩c驱动器中的文件,使其如下所示
C:\mysql-connector

3-运行命令

$ gem install mysql2 -v 0.3.14 -- '--with-mysql-dir="C:mysql-connector"'

它应该给你结果

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

4-如果您收到错误MySQL2 Gem为错误的MySQL客户端库编译

您需要从连接器文件中获取 DLL 文件你会在路径中找到它C:\mysql-connector\lib\libmysql.dll

然后将其复制到您的 Ruby 垃圾箱文件夹你会发现它可能是路径C:\Ruby200\bin

libmysql.dll是MySQL2正在寻找的。该文件位于 MySQL C 连接器的 lib 文件夹中。您可以从"http://dev.mysql.com/downloads/connector/c/"MSI 或 ZiP 下载连接器,但请确保您获得相同的架构 32 位或 64 位。否则,在安装 mySQL2 gem 时会出现错误,指出"有符号和无符号整数表达式之间的比较"和一大堆"未定义的引用"

下载

并安装连接器后(如果您下载了 MSI),请打开"MySQL 连接器 C 6.1",其中 6.1 是版本号 - 该文件夹位于程序文件(如果您下载了 32 位版本,则位于程序文件 (x86) 中)。转到"lib"文件夹并复制"libmysql.dll"和"libmysql.lib"并将它们粘贴到mysql服务器目录的"lib"文件夹中,例如"C:\MySQL\MySQL_Server_5.6\lib"

然后'gem install mysql -v [版本号] -- --with-mysql-dir="C:\MySQL\MySQL_Server_5.6\"'

相关内容

  • 没有找到相关文章

最新更新