Reputation: 54969
I am trying to set up my Env to use PostgreSQL with Rails and i followed the steps to install PostgreSQL from this Article
Am getting the following error
ATAL: database "myapp_development" does not exist Extracted source (around line #661):
rescue ::PG::Error => error
if error.message.include?("does not exist")
raise ActiveRecord::NoDatabaseError.new(error.message, error)
else
raise
end
Upvotes: 15
Views: 29701
Reputation: 9
In my case, the solution was to provide what the error said.."create the database that does not exist"....I spent many hours trying different commands or run db:migrate using bundle but none of that worked. I thought it should create the db on it's own but no...I eventually decided to create the db in postgres
sudo su - postgres
psql
CREATE DATABASE tableNameFromDatabase.yml WITH OWNER myusername;
after this rails db:migrate worked
Upvotes: 0
Reputation: 669
I was having a similar problem. I checked different websites and tried what they suggested but didn't work. Then I tried rake db:create:all
and rake db:migrate
it worked for me. Thank you!
Upvotes: 1
Reputation: 2088
You can also create PostgreSQL database manually by using psql command prompt.
When in there, connect to your local server and write "create database myapp_development;" without the quotes
Upvotes: 3
Reputation: 2516
Did you run rake db:create
and rake db:migrate
before rails server
?
Here's all the steps you should do:
cd /your/app/path
bundle install
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rails server
Upvotes: 64