gemmysql2安装

gemmysql2安装,mysql,gem,centos,Mysql,Gem,Centos,需要帮助安装mysql2。我找遍了所有的地方,都感到很沮丧。我是centos的新手,经常遇到一些障碍。我设法通过了大多数考试,但我正在寻求帮助。我运行以下命令 gem安装mysql2 [root bin]# gem install mysql2 Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native

需要帮助安装mysql2。我找遍了所有的地方,都感到很沮丧。我是centos的新手,经常遇到一些障碍。我设法通过了大多数考试,但我正在寻求帮助。我运行以下命令 gem安装mysql2

[root bin]# gem install mysql2
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for ruby/thread.h... no
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for rb_hash_dup()... no
checking for rb_intern3()... no
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing.  please check your installation of mysql and try again.
-----
*** 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=/usr/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


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql2-0.3.15 for       inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql2-0.3.15/ext/mysql2/gem_make.out
当我运行rpm-qa | grep mysql时,我有以下几点

[root bin]# rpm -qa | grep mysql
mysql-server-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.x86_64
mysql-devel-5.1.73-3.el6_5.x86_64
mysql-5.1.73-3.el6_5.x86_64
大多数其他解决方案都说要安装mysql-devel,但我已经安装了。我可以在/usr/include/mysql中看到mysql.h。大多数其他人在/usr/bin/mysql\u-config中也缺少行mysql\u-config

有人有IDE吗。谢谢

编辑:添加更多细节 Centos 6.5全新安装(Puppet labs repo的Puppet master,然后添加了epel,然后安装了Foreman,试图将sqlite迁移到mysql db,但需要安装mysql2 gem)
Mysql 5.1

好的,我找到了它,我查看了位于/usr/lib/ruby/gems/1.8/gems/mysql2-0.3.15/ext/mysql2/mkmf.log中的日志mkmf.log,发现

--------------------

have_header: checking for mysql.h... -------------------- yes

"gcc -E -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -I/usr/include/mysql    -O2 -g -pipe         -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64   -mtune=generic -fno-strict-aliasing  -fPIC    conftest.c$
checked program was:
/* begin */
1: #include <mysql.h>
/* end */

--------------------

然后我的gem安装了mysql2,这就解决了它。!希望这对其他人有帮助

我在gentoo上,试图
gem安装mysql2
,但我遇到了与您相同的错误,在我的系统中找不到
mysql.h
。在谷歌搜索之后,我删除了mysql连接器
sudoemerge-cdb/mysql-connector-C
,然后重新安装mysql
sudoemerge-mysql
/usr/include/mysql
中的所有头都返回

Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... no
checking for mysql/mysql.h... no

因此,在查看了日志mkmf.log之后,我发现在mysql.h旁边有一行以gcc开头。我不知道是否安装了gcc,所以我做了一个yum-gcc,并尝试了另一个gem安装mysql2,结果成功了!希望这对其他人有帮助
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... no
checking for mysql/mysql.h... no