Postgres. role “root” does not exist. When trying to pg:pull database from Heroku

createdb is a wrapper around the SQL statement CREATE DATABASE and as such it needs to connect to the database.

By default all Postgres commandline tools try to connect to the database using the current operating system user. As the error message indicates there is not user named root in the database. So you need to pass the name of the Postgres superuser in order for createdb to be able to connect. This user is usually named postgres.

Another option is to switch the Linux user to to postgres if such a Linux user exists.

I don’t know Heroku and I don’t know how you started createdb, but the parameter to pass a username is -U (for all Postgres command line programs). So you’d need

 createdb -U postgres name_of_new_database

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)