Pooja Mokariya
Pooja Mokariya

Reputation: 2120

Heroku Database setup

I am facing the below issue with heroku run rake db:create

Application in RubyonRails technology and Postgresql database.

This is the legacy Heroku CLI. Please install the new CLI from https://cli.heroku.com
Running rake db:create on ⬢ project-name... up, run.2367 (Free)
FATAL:  permission denied for database "postgres"
DETAIL:  User does not have CONNECT privilege.
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"abcdabcd", "username"=>"abcdabcd", "password"=>"abcdabcd", "port"=>5432, "host"=>"ec2-107-21-233-71.compute-1.amazonaws.com"}
rake aborted!
PG::ConnectionBad: FATAL:  permission denied for database "postgres"
DETAIL:  User does not have CONNECT privilege.

Can you tell me what I am missing to config in this app?

Thanks in advance.

Upvotes: 2

Views: 1288

Answers (1)

Damien MATHIEU
Damien MATHIEU

Reputation: 32629

You cannot run db:create on heroku. Instead, you need to provision a postgresql add-on. Doing so will create a database for you and give you it's credentials as the DATABASE_URL environment variable.

You can then run db:migrate to setup all the tables.
See also https://devcenter.heroku.com/articles/heroku-postgresql

Upvotes: 4

Related Questions