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

After installing mysql through brew and running rails server says

/!\ 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
Can you login to mysql at all (without using Rails) from the shell?βξhrαng

1 Answers

1
votes

I'm not seeing the mysql gem in your stacktrace so I suspect you might not have installed it. If so then add gem 'mysql' (or gem 'mysql2' if you prefer) to your Gemfile, run bundle install and start your server again.

Also, double-check that you are indeed running Rails 3 as mentioned in your question. The stacktrace shows that you are running Rails 2.3. So similarly, in your Gemfile, make sure you have gem 'rails', '3.0.0', then run bundle install, etc.