2011-06-01 46 views
6

我試圖讓我的rails應用程序生產,但這是我第一次。我正在運行mysql 5.5和gem 2.8.1。未初始化的常量Mysql :: error

當試圖耙分貝:設置RAILS_ENV =「生產」,我得到如下:

rake aborted! 
uninitialized constant Mysql::Error 

任何的幫助深表感謝

我想這可能是有益的補充跟蹤文件中查找該錯誤。任何幫助將不勝感激:

rake db:setup RAILS_ENV="production" --trace 
(in /Users/chris/rails_projects/sienab) 
** Invoke db:setup (first_time) 
** Invoke db:create (first_time) 
** Invoke db:load_config (first_time) 
** Invoke rails_env (first_time) 
** Execute rails_env 
** Execute db:load_config 
** Execute db:create 
rake aborted! 
uninitialized constant Mysql::Error 
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/railties/databases.rake:64:in `create_database' 
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/railties/databases.rake:35 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31 
/usr/bin/rake:19:in `load' 
/usr/bin/rake:19 

回答

8

Rails 3 Mysql Problems中所述,如果可能的話,您應該使用mysql2寶石。

確保在這兩個你的Gemfile改變mysqlmysql2和你的database.yml中的Gemfile

0

實際的錯誤是關於Mysql :: Error常量。

你在Gemfile中包含mysql gem嗎?

你在database.yml中使用mysql嗎?

+0

我: 組:生產做 \t寶石 'MySQL的' 結束 – chris 2011-06-01 19:43:08

+0

是在mysql的database.yml – chris 2011-06-01 19:44:34

相關問題