为什么我的rake db:migrate无法响应?

时间:2014-01-07 13:05:04

标签: mysql ruby-on-rails

我尝试在rake db:migrate中输入以创建迁移,但我的rake已中止并给我这个声明。你能解释一下为什么会这样吗?

Muhammeds-MacBook-Pro:simple_cms muhammedz786$ rake db:migrate
rake aborted!
dlopen(/Users/muhammedz786/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/mysql2-0.3.14/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Users/muhammedz786/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/mysql2-0.3.14/mysql2/mysql2.bundle
  Reason: image not found - /Users/muhammedz786/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/mysql2-0.3.14/mysql2/mysql2.bundle
/Users/muhammedz786/rails_application/simple_cms/config/application.rb:7:in `<top (required)>'
/Users/muhammedz786/rails_application/simple_cms/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

2 个答案:

答案 0 :(得分:1)

您的mysql软件包无法正确安装该命令

sudo apt-get install mysql-server mysql-common mysql-client

如果这不起作用,请安装此

sudo apt-get install libmysql-ruby libmysqlclient-dev

答案 1 :(得分:1)

根据您的问题,我发现您使用的是Macintosh。因此,请尝试以下方法:

  1. 在终端
  2. 中运行mysql_install_db
  3. 在终端
  4. 中运行mysql.server start
  5. 如果这不起作用,请结帐Installing mysql2 gem for Ruby on Rails with Mac OSX 10.6