mysql错误帮助...运行rake db时:setup RAILS_ENV =“production”

时间:2011-06-05 14:20:24

标签: mysql ruby-on-rails rubygems

我正在努力为我的第一个rails应用程序启动mysql并运行。 运行rake db时,我不断收到以下错误:setup RAILS_ENV =“production”:

rake aborted!
dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9):     Library not loaded: libmysqlclient.18.dyl Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2    /mysql2.bundle
/Users/chris/rails_projects/sienab/Rakefile:4
(See full trace by running task with --trace)

我正在运行雪豹,mysql 5.5,gem mysql2,rails 3。

任何帮助都很棒。非常感谢。

下面的database.yml         #SQLite版本3.x.         #gem install sqlite3         发展:           适配器:sqlite3           数据库:db / development.sqlite3           游泳池:5           超时:5000

    # Warning: The database defined as "test" will be erased and
    # re-generated from your development database when you run "rake".
    # Do not set this db to the same as development or production.
    test:
      adapter: sqlite3
      database: db/test.sqlite3
      pool: 5
      timeout: 5000

    production:
      adapter: mysql2
      encoding: utf8
      reconnect: false
      database: sienab_production
      pool: 5
      username: username
      password: password
      host: localhost

1 个答案:

答案 0 :(得分:2)

看起来你需要安装mysql2 libs:

sudo apt-get install libmysqlclient-dev libmysqlclient16

此外,如果您使用的是Rails 3.0.x,我建议您在Gemfile中使用gem 'mysql2','0.2.7'。 在进行此更改后,请不要忘记运行bundle install