0

I have been following a video tutorial and the database is created, but when trying to follow the step by going to directory and entering rake: dbmigrate I get an error.

Ians-MacBook-Pro:music_library iansherwood$ rake db migrate
rake aborted!
dlopen(/Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle
  Reason: image not found - /Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle
/Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `require'
/Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.2.4/lib/bundler/runtime.rb:68:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.2.4/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.2.4/lib/bundler/runtime.rb:66:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.2.4/lib/bundler/runtime.rb:66:in `block in require'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.2.4/lib/bundler/runtime.rb:55:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.2.4/lib/bundler/runtime.rb:55:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.2.4/lib/bundler.rb:128:in `require'
/Users/iansherwood/Sites/music_library/config/application.rb:7:in `<top (required)>'
/Users/iansherwood/Sites/music_library/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • 2
    There are a couple other similar questions http://stackoverflow.com/questions/4512362/rails-server-fails-to-start-with-mysql2-using-rvm-ruby-1-9-2-p0-on-osx-10-6-5 and http://stackoverflow.com/questions/4546698/library-not-loaded-libmysqlclient-16-dylib-error-when-trying-to-run-rails-serv that might help – Alex.Bullard Oct 15 '13 at 22:43

4 Answers4

2

Have you tried bundle exec rake db:migrate?

Another possibility is that you don't have my MySQL running. The easiest way to check for that would be:

ps aux | grep mysql

If it isn't running and you installed MySQL through homebrew (common video guide way to install it) then you can run mysql.server start.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Colto
  • 612
  • 4
  • 14
1

The syntax should be: rake db:migrate, and not rake: dbmigrate or rake db migrate.

mjnissim
  • 3,102
  • 1
  • 19
  • 22
1

It looks like your colon use might be inconsistent. Remember to use:

rake db:migrate

http://guides.rubyonrails.org/command_line.html

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
rainbowsorbet
  • 533
  • 5
  • 19
0

Did you include "gem 'mysql2'" in your Gemfile?

Tolsto
  • 1,418
  • 2
  • 17
  • 45