Rails / MySQL2: Error - Unknown database

33,287

Solution 1

Have you created the database in MySQL? You should be able to run rake db:create and have Rails create it for you.

Solution 2

I had the same error, please run the following command on the Command Prompt:

rake db:create 

to solve the problem.

Solution 3

Look for the answers of these questions:

  1. Have you installed the mysql2 gem?
  2. Is it mentioned in your Gemfile?
  3. Did you run the command rake db:create ?
Share:
33,287
KidKola
Author by

KidKola

Updated on September 18, 2020

Comments

  • KidKola
    KidKola over 3 years

    I'm following a basic tutorial in Linda. I have been able to install everything properly now, but when I start my Rails server I get this message when I visit localhost:3000:

    Unknown database 'simple_cms_development'
    

    and then

    Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
    Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (23.5ms)
    Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (29.8ms)