CentOS上的Rails 3 - mysql2 gem的问题?

时间:2012-03-09 18:39:00

标签: ruby-on-rails-3

那么有没有人能够在CentOS上成功运行Rails 3.2?这是我们看到的问题:

[root@scglobal-web01 current]# rails c
/var/www/html/webapps/intl-custserv/shared/bundle/ruby/1.9.1/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require': Incorrect MySQL client library version! This gem was compiled for 5.5.15 but the client library is 5.0.92. (RuntimeError)
    from /var/www/html/webapps/intl-custserv/shared/bundle/ruby/1.9.1/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `<top (required)>'

这里有一些关于我们环境的详细信息:

[root@scglobal-web01 ~]# cat /etc/redhat-release
CentOS release 5.7 (Final)
[root@scglobal-web01 ~]# mysql --version
mysql  Ver 14.14 Distrib 5.5.13, for Linux (x86_64) using readline 5.1  
[root@scglobal-web01 ~]# rvm list

rvm rubies

   jruby-1.6.7 [ amd64 ]
   ruby-1.8.7-p358 [ x86_64 ]
=* ruby-1.9.3-p125 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

[root@scglobal-web01 ~]# gem list --local

*** LOCAL GEMS ***

actionmailer (3.2.2)
actionpack (3.2.2)
activemodel (3.2.2)
activerecord (3.2.2)
activeresource (3.2.2)
activesupport (3.2.2)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.0, 1.0.22)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.2.0)
daemon_controller (1.0.0)
erubis (2.7.0)
execjs (1.3.0)
fastthread (1.0.7)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
jquery-rails (2.0.1)
json (1.6.5)
mail (2.4.3)
mime-types (1.17.2)
multi_json (1.1.0)
mysql2 (0.3.11)
passenger (3.0.11)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.2)
railties (3.2.2)
rake (0.9.2.2, 0.9.2)
rdoc (3.12)
sass (3.1.15)
sass-rails (3.2.4)
sprockets (2.1.2)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.32)
uglifier (1.2.3)
[root@scglobal-web01 ~]#


这里也是一些(可能)相关文件所在的地方:

[root@scglobal-web01 ~]# whereis mysql_config
mysql_config: /usr/bin/mysql_config /usr/share/man/man1/mysql_config.1.gz
[root@scglobal-web01 ~]# ls -al /usr/lib64/mysql
total 14988
drwxr-xr-x  3 root root     4096 Mar  7 22:59 .
drwxr-xr-x 44 root root    24576 Mar  7 23:15 ..
-rw-r--r--  1 root root   120260 May 11  2011 libmygcc.a
-rw-r--r--  1 root root 15148296 May 11  2011 libmysqlclient.a
lrwxrwxrwx  1 root root       16 Mar  7 22:59 libmysqlclient_r.a -> libmysqlclient.a
-rw-r--r--  1 root root    10000 May 11  2011 libmysqlservices.a
drwxr-xr-x  3 root root     4096 Mar  7 22:20 plugin
[root@scglobal-web01 ~]#

任何见解都将不胜感激!

由于

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。

运行:

  • CentOS版本6.3(最终版)
  • mysql Ver 14.14使用readline 5.1为Linux(x86_64)分发5.5.28
  • rvm and ruby​​ 1.9.3

到目前为止我所知道的是mysql-devel包是针对mysql 5.0.x而不是5.5

我需要使用新包重新安装gem。但到目前为止我无法做到这一点

迹象是

$ sudo yum install mysql-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.linuxwerk.com
 * epel: mirrors.n-ix.net
 * extras: mirror.jgotteswinter.com
 * updates: mirror.optimate-server.de
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-devel.x86_64 0:**5.1.69**-1.el6_4 will be installed

然后我们安装它。 bundle install适用于安装0.3.13。我们回到了:

$rails c
...../gems/mysql2-0.3.13/lib/mysql2.rb:8:in `require': Incorrect MySQL client library version! This gem was compiled for 5.1.69 but the client library is 5.5.28. (RuntimeError)