I have started to learn using heroku and i was trying to execute
bundle exec rake db:create db:migrate
command, i have encountered the following errors,
The problem is that you don't have ROLE on your local machine named root. Run this in a terminal:
psql
Then if you connect with PostgreSQL in your terminal:
CREATE ROLE root WITH PASSWORD 'root' WITH CREATEDB LOGIN CREATEROLE CREATEUSER SUPERUSER;
or just change in your database.yml file user to user, who exists with valid password.
P.S.
Don't run in your terminal:
heroku run rake db:create
Heroku creates for you database when you first time push your application to Heroku's servers.
But you can run:
heroku run rake db:migrate
When you add the Heroku Postgres add-on (or simply push a rails app to Heroku, and a dev one is added for you), a database is created for you.
Do not fun db:create
on Heroku Postgres, it's already created. You can skip to db:migrate
, et. al
If u are studying rails tutorial and you want to run a local server,you should have gem 'sqlite3' in gemfile,but if u want to push it to heroku you must replace gem 'sqlite3' with gem 'pg'.Or when running local server you can have them both,but when you push to heroku detele it because it's not suported.