Permission denied for database “postgres”, User does not have CONNECT privilege.

This is the error we got when we tried to run the db:create command on Heroku cloud. After we deployed our rails application on Heroku cloud we were trying to set up the database. As soon we run the rake db:create command we got into the following error:

$ heroku run rake db:create
Running rake db:create on ⬢ app-stage... up, run.7690 (Free)FATAL:  permission denied for database "postgres
"DETAIL:  User does not have CONNECT privilege.

Reason of the error

Actually the user we were trying the command didn’t have permission to run the rake db:create command. This is a common case in Heroku. Most of the users do not have CONNECT privilege. For this reason Heroku recommends db:schema:load, db:structure:load or db:migrate instead of db:setup or db:create.

Solution of the error

Instead of the rake db:create when we tried rake db:migrate the error was gone. The database was properly set.

Source:
CONNECT privilege

Share