Reputation: 3
Trying to run the database in RoR i have this error
Couldn't create database for {"adapter"=>"sqlite3", "pool"=>5, "timeout"=>5000, "database"=>"db/test.sqlite3"}
rake aborted!
Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded. Add gem 'mysql2' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
but when i do gem list i get that i have mysql2 (0.4.1)
How can i fix this? and also, why does this happens?
Upvotes: 0
Views: 126
Reputation: 39
You should include the mysql2 gem into your gemfile and run 'bundle install'.
Also your config/database.yml
should look something like the below
development:
adapter: mysql2
encoding: utf8
database: my_db_name
username: root
password: my_password
Here the username and password will be the one you gave at the time of configuring the mysql inyour system
Upvotes: 0
Reputation: 2597
Check /config/database.yml
file
Probably your file contains something like this:
development:
adapter: sqlite3
pool: 5
timeout: 5000
database: db/development.sqlite3
Change sqlite
to mysql
and add login settings, also check environment (development, production or test)
Upvotes: 1
Reputation: 5112
you need to run bundle install
as you have already added the gem in the Gemflle
.Also you need to setup mysql and other libs before installing it.
Upvotes: 0