I am trying to create a database using rake db:create
task.
When I am running the command bundle exec rake db:create
to create the database and load the schema, I get the following error:
rake aborted!
Mysql2::Error: Unknown database 'xxx_development'
My database.yml
:
development:
adapter: mysql2
host: localhost
reconnect: true
username: user
password: password
pool: 50
database: xxx_development
I checked that mysql server is running and I am able to connect to it using the password/username I have in the database.yml
I also understand that I can go ahead and create the database in mysql
and then run the bundle exec rake db:create
but isn't the rake task db:create
also creates a database in case it doesn't exists?
The rails
version is 3.2.22
.
and mysql2
version is 2.9.13
.
Any pointers will be highly appreciated.
If you are using ohmyzsh with bundler plugin which makes rake
run by default with bundle exec
, you can use
unbundled_rake db:create
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With