goksel
goksel

Reputation: 4580

rake aborted! uninitialized constant Mysql2

Goksel-Eryigits-Mac-mini:blog geryit$ rake db:migrate --trace
(in /Users/geryit/Sites/blog)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
Client does not support authentication protocol requested by server; consider upgrading MySQL client
/Users/geryit/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/mysql.rb:453:in `read'
/Users/geryit/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/mysql.rb:130:in `real_connect'
/Users/geryit/.rvm/gems/ruby-1.8.7-p330/gems/activerecord-3.0.3/lib/active_record/connection_adapters/mysql_adapter.rb:600:in `connect'
/Users/geryit/.rvm/gems/ruby-1.8.7-p330/gems/activerecord-3.0.3/lib/active_record/connection_adapters/mysql_adapter.rb:164:in `initialize
.
.
.

database.yml

development:
  adapter: mysql
  encoding: utf8
  database: test
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock

Upvotes: 9

Views: 16152

Answers (4)

goksel
goksel

Reputation: 4580

They work together now without any problems. The problem was Mysql version and mysql gem flags. I removed MYSQL 5.5 and installed Mysql 5.1 back. Everything is fixed. Thanks.

I wrote a blog post about installing, it can be helpful : https://geryit.com/blog/installing-mysql-with-rails-on-mac-os-x-snow-leopard/

Upvotes: 6

Saroj Yadav
Saroj Yadav

Reputation: 11

I was getting 'uninitialized constant Mysql' on Snow Leopard and Rails 3. Adding 'mysql' gem to Gemfile fixed it for me.

Upvotes: 1

farnoy
farnoy

Reputation: 7786

Have you defined

gem 'mysql2'

in Gemfile? For Rails 3 and Bundler, it's not enough to install the gem, but to include it in Gemfile.

Upvotes: 11

David Sulc
David Sulc

Reputation: 25994

Try uninstalling the mysql gem. It might be conflicting with the mysql2 gem you're using in your database.yml.

Upvotes: 2

Related Questions