Search code examples
postgresqlherokuheroku-toolbeltheroku-postgres

Heroku rake tasks state 'DETAIL: User does not have CONNECT privilege'


I have tried to run rake db:setup and get the: DETAIL: User does not have CONNECT privilege. error.

I have tried to run GRANT CONNECT ON DATABASE dbname TO user; suggested here: psql: permission denied for database "dbname" ("User does not have CONNECT privilege.") / "unrecognized role option 'connect'"

And I still get the error. Is there another command I should be running?


Solution

  • Heroku already creates the database for you, and you cant run rake db:create or rake db:drop because you don't have permissions. If you want to drop the database, this can be done via:

    heroku pg:reset DB_NAME
    

    If you just want to run the migrations, you can run rake db:migrate with no problems.