I\'m having trouble finding a solution to this problem. I\'m getting the error:
Please install the mysql adapter: \'gem install activerecord-mysql-adapter\'
1) You need to update your config/database.yml
file and change:
adapter: mysql
into
adapter: mysql2
2) You need to update your Gemfile
and explicitly add activerecord-mysql2-adapter
dependency there:
gem 'mysql2'
gem 'activerecord-mysql2-adapter'
I would say that change the commented information on top in database.yml to
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
second: add " gem 'mysql2' " (what ever is inside the double quotation marks) to gemfile .
save everything, do bundle install. Hope that helps.
or it just could be a typo.
I am facing the same issue and getting same error when run command
gem install activerecord-mysql2-adapter
you need to install libmysqlclient-dev
sudo apt-get install libmysqlclient-dev
It works for me
It is possible that you have changed adapter to mysql2 for a certain environment only but are not passing the environment to the rake command.
E.g. I only changed mysql to mysql2 on the production environment but was running
rake generate_secret_token
when I changed it to the following it worked:
rake generate_secret_token RAILS_ENV=production