Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';t在Ruby上安装MySQL2 0.3.16 gem_Mysql_Ruby On Rails_Ruby_Gem - Fatal编程技术网

Can';t在Ruby上安装MySQL2 0.3.16 gem

Can';t在Ruby上安装MySQL2 0.3.16 gem,mysql,ruby-on-rails,ruby,gem,Mysql,Ruby On Rails,Ruby,Gem,我在Ruby上安装mysql2 gem时遇到了很多问题,我尝试了很多指南,但似乎没有任何效果。。。下面是我在没有任何额外命令的情况下尝试安装它时出现的错误 C:\Users\Julián>gem install mysql2 --no-rdoc --no-ri Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Erro

我在Ruby上安装mysql2 gem时遇到了很多问题,我尝试了很多指南,但似乎没有任何效果。。。下面是我在没有任何额外命令的情况下尝试安装它时出现的错误

C:\Users\Julián>gem install mysql2 --no-rdoc --no-ri
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

C:/Ruby200-x64/bin/ruby.exe extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
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:/Ruby200-x64/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}/
    --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}/
    --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:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql
2-0.3.16 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/extensions/x64-mingw32/2.0.
0/mysql2-0.3.16/gem_make.out

我真的很困惑,我试图在这附近找到解决办法,但什么也找不到。我尝试安装MySQL连接器并使用MySQL lib命令进行设置。请帮忙

在终端中。。首先执行“查找mysql\u config”,然后将下面命令中的路径替换为该文件所在的位置


安装MySqL2——没有RDOC——没有RI——用MySQL COFIGG= <强>路径

> P>因为您使用Windows,您需要考虑安装<代码> MySQL C连接器< /Cord>头文件以使其工作

我们已经写了一篇文章

--

您需要使用以下步骤:

  • 安装
    MYSQL C-Connector
    文件(路径中没有空格)
  • 再次安装MYSQL2 gem(使用正确的路径引用)
  • lbmysql.dll
    复制到您的
    ruby/bin
    文件夹中
  • 首先,您需要下载MYSQL C-Connector文件:

    它必须是32位C连接器

    将其安装到没有空格的路径后,可以再次使用
    mysql2
    installation命令,并使用以下配置选项:

    gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:\mysql-connector-path"'
    
    在此之后,您可以将
    libmysql.dll
    mysql
    文件传输到
    ruby/bin
    目录:


    这可能会有帮助[单击此处][1][1]:谢谢你,不过,在你的网站上,gem install mysql2-platform=ruby命令的字体很漂亮 — ‘—使用mysql dir=“C:\mysql connector path””粘贴时会出错。。。没有大的和+1。。再次感谢。如何指定要安装的verison<代码>--版本0.3.16不起任何作用。