0

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.

Ron Dear
  • 505
  • 1
  • 5
  • 16
  • Looks like this is the same issue as http://stackoverflow.com/questions/4546698/library-not-loaded-libmysqlclient-16-dylib-error-when-trying-to-run-rails-serve. – bcurren Aug 14 '11 at 17:39
  • I tried that. It's still not working. I'm still getting the same error. – Ron Dear Aug 14 '11 at 19:28

1 Answers1

1

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

jschorr
  • 3,034
  • 1
  • 17
  • 20