通过自制软件安装mysql有什么问题

时间:2011-05-09 05:48:45

标签: mysql ruby-on-rails macos homebrew

Mac Version: 10.6.7
Ruby Version: 1.9.2-p180
Rails Version: 2.3.5

通过brew安装mysql并运行rails server后说

/!\ 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/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:589:in `real_connect'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:589:in `connect'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:203:in `initialize'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:75:in `new'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:75:in `mysql_connection'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/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/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/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/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in `cache'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:in `call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/hoptoad_notifier-2.4.9/lib/hoptoad_notifier/rack.rb:27:in `call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/hoptoad_notifier-2.4.9/lib/hoptoad_notifier/user_informer.rb:12:in `call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rack-1.0.1/lib/rack/lock.rb:11:in `block in call'
    :10:in `synchronize'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:114:in `block in call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:34:in `run'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in `call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rails-2.3.5/lib/rails/rack/static.rb:31:in `call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rack-1.0.1/lib/rack/urlmap.rb:46:in `block in call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `each'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rails-2.3.5/lib/rails/rack/log_tailer.rb:17:in `call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rack-1.0.1/lib/rack/content_length.rb:13:in `call'
    /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/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'

1 个答案:

答案 0 :(得分:1)

我没有在你的堆栈跟踪中看到mysql gem,所以我怀疑你可能没有安装它。如果是,请将gem 'mysql'(或gem 'mysql2',如果您愿意)添加到您的Gemfile中,运行bundle install并重新启动服务器。

另外,请仔细检查您确实正在运行Rails 3,如问题中所述。堆栈跟踪显示您正在运行Rails 2.3。所以类似地,在你的Gemfile中,确保你有gem 'rails', '3.0.0',然后运行bundle install等。