Ron Dear
Ron Dear

Reputation: 505

Problem with rake - unable to load mysql2 library

A few things. I have mysql and the mysql2 gems installed. I have also edited the gem file to require the mysql2 gem. I have also tried this with both 0.3.6 and 0.2.7 versions of the 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.

I have spent two days now trying to get mysql working with Rails. Any help you can give would be greatly appreciated.

Upvotes: 0

Views: 170

Answers (1)

jschorr
jschorr

Reputation: 3054

Try this (add to ~/.bash_profile if you're using a Bash shell, not .profile):

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

Then do:

source ~/.bash_profile

Upvotes: 1

Related Questions