Initialize Rails App Databases Using MySQL After Cloning Repository From Github

So I cloned my colleague’s rails app from github and wanted to run it on my machine so I can collaborate on the code.  But I kept getting the error that the database didn’t exist.

ActiveRecord::NoDatabaseError (Unknown database 'owl_development')

First, I checked what database this rails app was using by looking at the database.yml file and found it was using mysql and the mysql2 gem.

So I made sure that I had mysql installed on my system by using homebrew and the brew install mysql command.  Then I tried rake db:migrate and still got the error that the database didn’t exist.

What I had forgotten to do after I cloned the repo was run

rake db:create

to create the databases.  I know this is obvious in hindsight, but I spent like 3 hours searching around until I figured out that’s what I had forgotten.  Hopefully this will save you some time!

partial credit here

Advertisements