1
votes

I'm trying run a rake db:create and it says that the database already exists (I never created this database before, this a new project). When I run rake db:migrate it says "Unknown database". I checked the mysql database (show databases;) and that database really does not exist.

Anyone knows what is that? I searched for solutions but without success.

When I run rake db:create

rake db:create
Celluloid 0.17.3 is running in BACKPORTED mode. [ http://git.io/vJf3J ]
adimax_development already exists
adimax_test already exists

When I run rake db:migrate

rake db:migrate
Celluloid 0.17.3 is running in BACKPORTED mode. [ http://git.io/vJf3J ]
rake aborted!
Mysql2::Error: Unknown database 'adimax_development'

database.yml

development:
 adapter: mysql2
 encoding: utf8
 database: adimax_development
 pool: 5
 username: root
 password:

Error: Error image:

2
what does your database.yml file define as the host and port? That file will tell Rails how to connect to the MySql db server - Darkisa
can you post your database.yml file ? - sameera207
@sameera207 I updated the question with my database.yml. Thanks - Felipe Marcon
@Darkisa I updated the question with my database.yml. Thanks - Felipe Marcon
Are you able to go into the mysql instance with rails dbconsole? - Leo Correa

2 Answers

4
votes

Try executing this command:

rake db:drop db:create db:migrate

Reference: https://stackoverflow.com/a/4116124/9336629

-2
votes

I got solve this creating the database directly in mysql.

I entered in mysql with mysql -u root and than I run "CREATE DATABASE adimax_development;". After this I comeback to my application and run rake db:migrate and that worked.

Thanks to all those who have been willing to help.