1
votes

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!!!

1
show an output of bundle list|grep sqlМалъ Скрылевъ
Check that your Gemfile includes a line with gem 'mysql2'PinnyM
Gemfile sure does have gem 'mysql2' line.Sasha Kastsiushkin
bundle list|grep sql: * mysql2 (0.3.14)Sasha Kastsiushkin
try to run bundle exec rake db:migrate (and I hope you use some ruby manager, such as rvm, rbenv,...)gotva

1 Answers

1
votes

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.