简体   繁体   English

rake 的问题 - 无法加载 mysql2 库

[英]Problem with rake - unable to load mysql2 library

A few things.一些东西。 I have mysql and the mysql2 gems installed.我安装了 mysql 和 mysql2 gems。 I have also edited the gem file to require the mysql2 gem.我还编辑了 gem 文件以要求 mysql2 gem。 I have also tried this with both 0.3.6 and 0.2.7 versions of the gem.我也尝试过使用 0.3.6 和 0.2.7 版本的 gem。 Both get me the same error when running:运行时两者都给我同样的错误:

rake db:migrate

The error is:错误是:

dlopen(/Users/rdear/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.2.7/lib/mysql2/
mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib

Referenced from: /Users/rdear/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-
0.2.7/lib/mysql2/mysql2.bundle

Reason: image not found - /Users/rdear/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-
0.2.7/lib/mysql2/mysql2.bundle

Also the database.yml is set to use the mysql2 adapter.此外,database.yml 设置为使用 mysql2 适配器。

I have spent two days now trying to get mysql working with Rails.我花了两天时间试图让 mysql 与 Rails 一起工作。 Any help you can give would be greatly appreciated.您可以提供的任何帮助将不胜感激。

Try this (add to ~/.bash_profile if you're using a Bash shell, not.profile):试试这个(添加到 ~/.bash_profile 如果你使用的是 Bash shell,not.profile):

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH

Then do:然后做:

source ~/.bash_profile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM