2011-05-09 46 views
0
 
Mac Version: 10.6.7 
Ruby Version: 1.9.2-p180 
Rails Version: 2.3.5 

安裝通過BREW安裝MySQL和運行軌道服務器後的mysql說有什麼問題通過自制

 
/!\ FAILSAFE /!\ 2011-05-09 11:18:22 +0545 
    Status: 500 Internal Server Error 
    Can't connect to MySQL server on '127.0.0.1' (61) 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:589:in `real_connect' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:589:in `connect' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:203:in `initialize' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:75:in `new' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:75:in `mysql_connection' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `block (2 levels) in checkout' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `block in checkout' 
    /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in `cache' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:in `call' 
    /Users/me/.rvm/gems/[email protected]/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call' 
    /Users/me/.rvm/gems/[email protected]/gems/hoptoad_notifier-2.4.9/lib/hoptoad_notifier/rack.rb:27:in `call' 
    /Users/me/.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call' 
    /Users/me/.rvm/gems/[email protected]/gems/hoptoad_notifier-2.4.9/lib/hoptoad_notifier/user_informer.rb:12:in `call' 
    /Users/me/.rvm/gems/[email protected]/gems/rack-1.0.1/lib/rack/lock.rb:11:in `block in call' 
    :10:in `synchronize' 
    /Users/me/.rvm/gems/[email protected]/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call' 
    /Users/me/.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:114:in `block in call' 
    /Users/me/.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:34:in `run' 
    /Users/me/.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in `call' 
    /Users/me/.rvm/gems/[email protected]/gems/rails-2.3.5/lib/rails/rack/static.rb:31:in `call' 
    /Users/me/.rvm/gems/[email protected]/gems/rack-1.0.1/lib/rack/urlmap.rb:46:in `block in call' 
    /Users/me/.rvm/gems/[email protected]/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `each' 
    /Users/me/.rvm/gems/[email protected]/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `call' 
    /Users/me/.rvm/gems/[email protected]/gems/rails-2.3.5/lib/rails/rack/log_tailer.rb:17:in `call' 
    /Users/me/.rvm/gems/[email protected]/gems/rack-1.0.1/lib/rack/content_length.rb:13:in `call' 
    /Users/me/.rvm/gems/[email protected]/gems/rack-1.0.1/lib/rack/handler/webrick.rb:50:in `service' 
    /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service' 
    /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run' 
    /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread' 

+0

你可以從shell登錄到mysql(不使用Rails)嗎? – Behrang 2011-05-09 09:53:11

回答

1

我沒有看到MySQL的寶石在你的堆棧跟蹤,所以我懷疑你可能沒有安裝它。如果是,則將gem 'mysql'(或gem 'mysql2',如果您願意的話)添加到您的Gemfile中,運行bundle install並再次啓動服務器。

此外,請仔細檢查您確實正在運行Rails 3,如您的問題中所述。堆棧跟蹤顯示您正在運行Rails 2.3。所以同樣,在你的Gemfile中,確保你有gem 'rails', '3.0.0',然後運行bundle install等。

+0

Thx用於指出滑軌版本。它是2.3.5,但是是3.0.0錯誤 – a5his 2011-05-09 07:22:48

+0

安裝mysql gem是否解決了你的問題? – mbreining 2011-05-10 07:00:34

+0

我懷疑是這樣。我最近安裝了Rails 2.3.5,並且在安裝說明中明確指出,該版本中沒有包含Rails的MySQL gem,所以你必須'gem install mysql'才能使MySQL工作。 – jmlane 2011-05-19 18:34:16