1

I have RoR 4.0 and ruby-1.9.3-p484 installed. gem install bundler and bundle install run without any errors. Then I need to create a db using rake db:create and I'm getting following error (I get the same error on rake about as well):

rake aborted! Could not load 'active_record/connection_adapters/mysql2_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.

From gem list:
activerecord-mysql2-adapter (0.0.3)
mysql2 (0.3.14)
rake (10.1.1, 0.9.2.2)

config/database.yml
adapter: mysql2
encoding: utf8
host: localhost
database: my_database
pool: 20
username: root
password:
socket: /tmp/mysql.sock

MySQL is running

Please let me know if I should share some more informaion. Thank you!!!

12
  • show an output of bundle list|grep sql Commented Jan 13, 2014 at 19:22
  • Check that your Gemfile includes a line with gem 'mysql2' Commented Jan 13, 2014 at 19:38
  • Gemfile sure does have gem 'mysql2' line. Commented Jan 13, 2014 at 20:06
  • bundle list|grep sql: * mysql2 (0.3.14) Commented Jan 13, 2014 at 20:06
  • try to run bundle exec rake db:migrate (and I hope you use some ruby manager, such as rvm, rbenv,...) Commented Jan 13, 2014 at 20:32

1 Answer 1

1

Thank you everybody for your suggestions! I finally found the solution.

Apparently, mysql2 gem did not work well with mysql-5.5.12. It was also installed from source files on my mac. I deleted mysql from my machine and installed it using Brew following steps here. Everything seems fine now.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.