2011-06-05 27 views
2

我努力嘗試讓MySQL啓動並運行我的第一個rails應用程序。 運行耙分貝時,我不斷收到以下錯誤:安裝RAILS_ENV =「生產」:mysql錯誤幫助...運行耙db:設置RAILS_ENV =「生產」

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,寶石mysql2,軌道3

任何幫助是巨大的。非常感謝。

的database.yml以下 #的SQLite 3.x版 #創業板安裝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 
+0

您是否曾嘗試在命令的開頭添加'bundle exec',以便在捆綁的gem環境中運行它? – Ant 2011-06-05 14:26:52

+0

這是否有所作爲:'rake db:setup RAILS_ENV = production' – apneadiving 2011-06-05 14:55:50

+0

否則,顯示您的'database.yml'文件 – apneadiving 2011-06-05 14:56:52

回答

2

看起來你需要安裝mysql2庫:

sudo apt-get install libmysqlclient-dev libmysqlclient16 

另外,我建議你如果您使用的是Rails 3.0.x,請在您的Gemfile中使用gem 'mysql2','0.2.7'。 進行此更改後,請不要忘記運行bundle install