2011-10-10 63 views
1

我剛剛安裝了RVM,JRuby,Rails和MySQL,但是我在創建數據庫時遇到了一些麻煩。當我運行rake db:create --trace我得到以下的輸出:rake db:create not working with mysql database(OS X)

rake db:create --trace 
JRuby limited openssl loaded. http://jruby.org/openssl 
gem install jruby-openssl for full support. 
** 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 
/Users/max/.rvm/gems/jruby-1.6.4/gems/activerecord-3.0.8/lib/active_record/railties/databases.rake:64:in `create_database' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/activerecord-3.0.8/lib/active_record/railties/databases.rake:33:in `(root)' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/task.rb:205:in `call' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/task.rb:200:in `each' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain' 
/Users/max/.rvm/rubies/jruby-1.6.4/lib/ruby/1.8/monitor.rb:191:in `mon_synchronize' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/application.rb:90:in `each' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/application.rb:62:in `run' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/lib/rake/application.rb:59:in `run' 
/Users/max/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2/bin/rake:32:in `(root)' 
/Users/max/.rvm/gems/jruby-1.6.4/bin/rake:19:in `load' 
/Users/max/.rvm/gems/jruby-1.6.4/bin/rake:19:in `(root)' 
Tasks: TOP => db:create 

我不知道什麼可能是錯誤的。有沒有人有任何想法?

+0

你有在Gemfile中mysql的寶石和你運行'束install'? – drummondj

+1

http://infinite-sushi.com/2010/07/uninitialized-constant-mysqlerror-with-rails-3/ –

回答

2

你使用雪豹嗎?

問題可能出現在Mysql版本和gem標誌中。刪除的Mysql 5.5,如果您有(MySQL 5.1中是一個穩定的版本)

在這裏rake aborted! uninitialized constant Mysql2一看,這裏http://geryit.com/blog/2011/01/installing-mysql-with-rails-on-mac-os-x-snow-leopard/

+0

我使用的Ubuntu和我不知道如何在Mac上的工作,但會建議,MySQL服務沒有運行。即使我在Linux上,我仍然必須重新啓動計算機,我忘了重新啓動mysql。它不止一次地在我後面咬傷我。 – Tass

+1

在OS X上,您可以安裝MySQL的偏好設置窗格。這給你即時的視覺確認MySQL正在運行。我還爲MySQL服務器安裝了一個啓動項目,所以MySQL一直運行,除非我明確地告訴它停止或崩潰。 – Max

相關問題