Trying to access my ruby ​​project - LoadError related to mysql

I am trying to access my first ruby ​​project. After going to the appropriate directory and entering:

$ rails server

The following error message appears:

/Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2.rb:7:in '     of /Users/Rozey/.rvm/gems/ruby-1.9 .2-p180 / gems / bundler-1.0.10 / lib / bundler / runtime.rb: 68: in block (2 levels) in require '<w> from /Users/Rozey/.rvm/gems/ruby-1.9. 2-p180 / gems / bundler-1.0.10 / lib / bundler / runtime.rb: 66: in block in require '     from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/bundler- 1.0.10 / lib / bundler / runtime.rb: 55: in require '     from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler.rb: 120: in '     from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:28:in block in'require': dlopen(/Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2.rb:7:in

require'
from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in
each'
from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in

each'
from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in

require' from /Users/Rozey/Sites/first_project/config/application.rb:7:in
require'
from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:28:in

    from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:27:in '     from script / rails: 6: in 'tap'
from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:27:in

require'
from script/rails:6:in

I previously installed gem mysql2 using RVM. I know that there is probably a simple solution, but I am new to this, so I appreciate your help.

Additional Information:

$ Rozey, ruby
/Users/Rozey/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
Rozey $, that the mysql
/ usr / local / the mysql / bin directory / the mysql

+3
source share
3 answers
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/" 

bash.profile

+3

I tried all of the above and none of them worked. I found this on another page The library is not loaded: libmysqlclient.16.dylib error when trying to start the rails server on OS X 10.6 using gem mysql2 , and it worked like a charm:

sudo ln -s / usr / local / mysql / lib / libmysqlclient.18.dylib / usr / lib / libmysqlclient.18.dylib

+1
source

All Articles