2012-03-09 57 views
1

那麼是否有人能夠在CentOS上成功運行Rails 3.2?以下是我們所看到的問題:CentOS上的Rails 3 - mysql2 gem的問題?

[[email protected] 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)>' 


下面是我們的環境的一些詳細信息:

[[email protected] ~]# cat /etc/redhat-release 
CentOS release 5.7 (Final) 
[[email protected] ~]# mysql --version 
mysql Ver 14.14 Distrib 5.5.13, for Linux (x86_64) using readline 5.1 
[[email protected] ~]# 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 

[[email protected] ~]# 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) 
[[email protected] ~]# 


這裏也是其中一些(也許)相關的文件駐留:

[[email protected] ~]# whereis mysql_config 
mysql_config: /usr/bin/mysql_config /usr/share/man/man1/mysql_config.1.gz 
[[email protected] ~]# 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 
[[email protected] ~]# 


任何有識之士將不勝感激!

謝謝

+0

你有2個版本的MySQL安裝? – 2012-03-09 18:43:08

+0

這是一個好主意!但我認爲我們不這樣做。 '[根@ scglobal-WEB01〜]#mysql的哪個 在/ usr/bin中/ MySQL的 [根@ scglobal-WEB01〜]#' – papaganouche 2012-03-09 18:45:53

+0

'''which'''只想告訴你,已經找到了第一格。你可能需要做更多的挖掘。 – 2012-03-09 21:39:50

回答

0

我有同樣的確切問題。

上運行:

  • CentOS的6.3(最終)
  • MySQL的版本14.14 DISTRIB 5.5.28,用於Linux(x86_64的),使用的readline 5.1
  • RVM和紅寶石釋放1.9.3

我到目前爲止所做的是mysql-devel包是用於mysql 5.0.x而不是5.5

我需要用新包裝重新安裝寶石。但我不能這樣做,到目前爲止

跡象

$ 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 

,我們得到後安裝。捆綁安裝很好地安裝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)