首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mysql2 gem安装失败

mysql2 gem安装失败
EN

Stack Overflow用户
提问于 2012-08-25 05:52:57
回答 4查看 11K关注 0票数 2

我的堆栈如下:

  • CentOS 6.3
  • 安装了MySQL 5.5 (遵循http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/的步骤,因为yum仍然有MySQL 5.1,如果我尝试安装任何与mysql相关的包,它当然会中断,因为yum将期望5.1)。 $> mysql -版本mysql 14.14远端5.5.27,用于Linux (x86_64),使用readline5.1 $> ruby -版本ruby 1.9.3p194 (2012-04-20修订版35410) x86_64-linux 维恩·E·塞金( $> E. Seguin,Michal Papis https://rvm.io/ )的rvm 1.14.6 (稳定版) $> uname -a Linux localhost.mkf 2.6.32-279.5.1.el6.x86_64 #1 SMP Tue Aug 14 23:54:45 UTC 2012 x86_64 GNU/Linux $> nginx -v nginx版本: $> rails -v Rails 3.2.6

当我试图安装mysql2 gem时,会出现以下错误:

代码语言:javascript
复制
$> gem install mysql2
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
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
--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/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-mysql-config
--without-mysql-config


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11       for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-    0.3.11/ext/mysql2/gem_make.out

当我这么做

代码语言:javascript
复制
$> find / -name mysql.h  

我什么也得不到

Mysql正在正常运行,我已经在其中创建了db和表,sql正在运行,没有任何问题。

是否有可能在我的堆栈中安装mysql2 gem?如果是的话,你知道我错过了什么吗?

UPDATE:我尝试了yum install mysql-devel它会引发错误,因为我已经安装了mysql5.5,使用yum install mysql-devel存储库。而百胜则期望mySql 5.1

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2012-09-04 12:32:18

我把它做好了:

代码语言:javascript
复制
 wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-devel-5.5.27-1.el6.x86_64.rpm 

 rpm -Uvh MySQL-devel-5.5.27-1.el6.x86_64.rpm 

 gem install mysql 

 gem install mysql2
票数 3
EN

Stack Overflow用户

发布于 2012-08-25 06:13:21

你安装mysql了吗?如果不这样做,还需要安装mysql dev文件,以便对gem进行本机编译。

代码语言:javascript
复制
sudo yum install mysql-devel

检查这个已经解释过的Errors Installing mysql2 gem via the Bundler

票数 17
EN

Stack Overflow用户

发布于 2014-02-24 23:48:36

如果得到这样的错误

代码语言:javascript
复制
$ sudo yum install mysql-devel

Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
10gen                                                                                                                                                      | 2.5 kB     00:00
base                                                                                                                                                       | 3.7 kB     00:00
centosplus                                                                                                                                                 | 3.4 kB     00:00
Not using downloaded repomd.xml because it is older than what we have:
  Current   : Wed Feb 12 07:03:25 2014
  Downloaded: Sat Jan  4 21:29:15 2014
contrib                                                                                                                                                    | 2.9 kB     00:00
epel                                                                                                                                                       | 4.2 kB     00:00
epel/primary_db                                                                                                                                            | 5.9 MB     00:00
extras                                                                                                                                                     | 3.4 kB     00:00
newrelic                                                                                                                                                   |  951 B     00:00
rpmforge                                                                                                                                                   | 1.9 kB     00:00
rpmforge-extras                                                                                                                                            | 1.9 kB     00:00
ucloud                                                                                                                                                     | 1.3 kB     00:00
updates                                                                                                                                                    | 3.4 kB     00:00
updates/primary_db                                                                                                                                         | 2.0 MB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-devel.x86_64 0:5.1.73-3.el6_5 will be installed
--> Processing Dependency: mysql = 5.1.73-3.el6_5 for package: mysql-devel-5.1.73-3.el6_5.x86_64
--> Finished Dependency Resolution
Error: Package: mysql-devel-5.1.73-3.el6_5.x86_64 (updates)
           Requires: mysql = 5.1.73-3.el6_5
           Installed: mysql-5.5.34-1.el6.remi.x86_64 (@remi)
               mysql = 5.5.34-1.el6.remi
           Available: mysql-5.1.71-1.el6.x86_64 (base)
               mysql = 5.1.71-1.el6
           Available: mysql-5.1.73-3.el6_5.x86_64 (updates)
               mysql = 5.1.73-3.el6_5
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

尝尝这个

代码语言:javascript
复制
sudo yum --enablerepo=remi -y install mysql-devel
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12119567

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档