Ruby on Rails 3, MySQL gem problems with Mac OS X Snow Leopard
Monday 28 June 2010
I’ve been trying to get into Ruby on Rails 3 but have been running into lots of problems that keep sending me back to Rails 2.x with my tail between my legs.
The latest problem is when I create a new Rails 3 beta 4 app with MySQL as the default database. I run bundle install and everything looks good, but when I start the app I get the following error:
undefined method `init' for Mysql:Class
The backtrace ends here:
activerecord (3.0.0.beta4) lib/active_record/connection_adapters/mysql_adapter.rb:30:in `mysql_connection'
My system set up is:
- Ruby: ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
- Rails: Version 3 Beta 4
- Mac: Snow Leopard 10.6.4
- MySQL gem version 1.3.6
I ended up getting the app working by changing from the mysql gem to the ruby-mysql gem.