mysql和乘客 - 错误“库未加载”

时间:2011-05-02 07:32:45

标签: mysql ruby-on-rails passenger rvm

就像Meltemi在这篇文章上发表的那样:Passenger error "library not loaded"我得到同样的错误。但是发布的答案没有帮助!

dlopen(/Users/andi/.rvm/gems/ruby-1.9.2-p136/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle, 9):
Library not loaded: libmysqlclient.16.dylib
Referenced from: /Users/andi/.rvm/gems/ruby-1.9.2-p136/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/andi/.rvm/gems/ruby-1.9.2-p136/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle

我使用RVM 1.2.6,Rails 3.0.3,Ruby 1.9.2进行操作。服务器工作正常,直到我将我的存储库从svn切换到git。我觉得这个改变影响了我的安装,这似乎很奇怪。

$bundle list
Gems included by the bundle:
...
  * mysql2 (0.2.7)
...


$ /usr/local/mysql-5.5.8-osx10.6-x86_64/bin/mysql --version
/usr/local/mysql-5.5.8-osx10.6-x86_64/bin/mysql  Ver 14.14 Distrib 5.5.8, for osx10.6 (i386) using readline 5.1

响应![/ p>

编辑:解决方案:

根据rails server fails to start with mysql2 using rvm & ruby 1.9.2-p0 on OSX 10.6.5http://freddyandersen.wordpress.com/2010/10/03/mysql-5-5-snow-leopard-and-rails/

这个命令解决了我的问题: sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib~ / .rvm / gems / ruby​​-1.9.2-p136 / gems / mysql2-0.2.7 / lib / mysql2 / mysql2.bundle

1 个答案:

答案 0 :(得分:2)

溶液:

根据rails服务器无法启动mysql2使用rvm& OSX 10.6.5和http://freddyandersen.wordpress.com/2010/10/03/mysql-5-5-snow-leopard-and-rails/

上的ruby 1.9.2-p0

这个命令解决了我的问题:sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib~ / .rvm / gems / ruby​​-1.9.2-p136 / gems / mysql2 -0.2.7 / LIB / mysql2 / mysql2.bundle