Skip to content

Instantly share code, notes, and snippets.

@tllucero
Created December 22, 2010 06:52
Show Gist options
  • Save tllucero/751195 to your computer and use it in GitHub Desktop.
Save tllucero/751195 to your computer and use it in GitHub Desktop.
Rails 3.0.3 mysql2 error
I'm getting this error. I am using the mysql2 adapter, both installed in rvm and in database.yaml. Verified that mysql2 is installed in the correct rvm directory. Verified that I can connect to and access the MySQL database using rails console - therefore, user name and password are correct in database.yaml
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/connection_adapters/mysql_adapter.rb:22:in `rescue in mysql_connection': !!! Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2' (RuntimeError)
Solved. Must install both the mysql and mysql2 as the current version of mysql_adapter.rb has require 'mysql' hardcoded on line 22. Changing that to require 'mysql2' doesn't solve the issue. Rails console accesses the MySQL database without hitting that code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment