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

Alejandro Veintimilla

Im new to Postgres and to Heroku. I am trying to pull the database from Heroku but I'm missing something simple. I did:

heroku pg:pull HEROKU_POSTGRESQL_IVORY_URL localdb

And I got the error:

createdb: database creation failed: ERROR:  permission denied to create database

Then I tried the same with "sudo". and I got:

createdb: could not connect to database template1: FATAL:  role "root" does not exist

So, it must be I'm missing some simple commands I can't find. Im on Linux, I have Postgres installed and working.

a_horse_with_no_name

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Could not connect to database postgres: FATAL: role"_postgres" does not exist

From Dev

Heroku pg:psql command throwing psql: FATAL: database "'" does not exist

From Dev

FATAL: role "root" does not exist

From Dev

Heroku pg:pull stalls out on tiny database?

From Dev

PG::ConnectionBad FATAL: role "Myname" does not exist

From Dev

PG::ConnectionBad FATAL: role "Myname" does not exist

From Dev

heroku postgresql database rails app PG::UndefinedTable: ERROR: relation "comments" does not exist

From Dev

Heroku SQLAlchemy database does not exist

From Java

psql: FATAL: role "postgres" does not exist

From Dev

role "postgres" does not exist; cannot createuser

From Dev

In Rails, Ransack search gives the error `PG::UndefinedFunction: ERROR: operator does not exist` when trying to filter by ID

From Dev

In Rails, Ransack search gives the error `PG::UndefinedFunction: ERROR: operator does not exist` when trying to filter by ID

From Dev

Permission denied with Heroku pg:pull to my local database

From Dev

pg_restore error: role XXX does not exist

From Dev

heroku pg:pull -e does not exclude given models

From Dev

Download PG database as a file from Heroku

From Dev

Why does a role shows as "not exist" even when present in the database (asp.net mvc)

From Dev

403 error when trying to backup AWS S3 database to heroku postgres

From Dev

Postgres FATAL database does not exist Django

From Dev

Postgres with sinatra results in "database does not exist" on deploy

From Dev

Postgres FATAL database does not exist Django

From Java

pg_dump postgres database from remote server when port 5432 is blocked

From Dev

Heroku + Apartment PG::Error: ERROR: function pg_stat_statements_reset() does not exist

From Dev

pg_restore ERROR: “Relation does not exist” and creating new database

From Dev

Heroku/Rails: PG:: Undefined Table: error "[tablename]" does not exist on heroku rails migration

From Dev

"Operator does not exist: integer =?" when using Postgres

From Dev

Relation does not exist when trying to grant privileges

From Dev

"ERROR: role "$user" does not exist" when setting up postgresql server

From Dev

"ERROR: role "$user" does not exist" when setting up postgresql server

Related Related

  1. 1

    Could not connect to database postgres: FATAL: role"_postgres" does not exist

  2. 2

    Heroku pg:psql command throwing psql: FATAL: database "'" does not exist

  3. 3

    FATAL: role "root" does not exist

  4. 4

    Heroku pg:pull stalls out on tiny database?

  5. 5

    PG::ConnectionBad FATAL: role "Myname" does not exist

  6. 6

    PG::ConnectionBad FATAL: role "Myname" does not exist

  7. 7

    heroku postgresql database rails app PG::UndefinedTable: ERROR: relation "comments" does not exist

  8. 8

    Heroku SQLAlchemy database does not exist

  9. 9

    psql: FATAL: role "postgres" does not exist

  10. 10

    role "postgres" does not exist; cannot createuser

  11. 11

    In Rails, Ransack search gives the error `PG::UndefinedFunction: ERROR: operator does not exist` when trying to filter by ID

  12. 12

    In Rails, Ransack search gives the error `PG::UndefinedFunction: ERROR: operator does not exist` when trying to filter by ID

  13. 13

    Permission denied with Heroku pg:pull to my local database

  14. 14

    pg_restore error: role XXX does not exist

  15. 15

    heroku pg:pull -e does not exclude given models

  16. 16

    Download PG database as a file from Heroku

  17. 17

    Why does a role shows as "not exist" even when present in the database (asp.net mvc)

  18. 18

    403 error when trying to backup AWS S3 database to heroku postgres

  19. 19

    Postgres FATAL database does not exist Django

  20. 20

    Postgres with sinatra results in "database does not exist" on deploy

  21. 21

    Postgres FATAL database does not exist Django

  22. 22

    pg_dump postgres database from remote server when port 5432 is blocked

  23. 23

    Heroku + Apartment PG::Error: ERROR: function pg_stat_statements_reset() does not exist

  24. 24

    pg_restore ERROR: “Relation does not exist” and creating new database

  25. 25

    Heroku/Rails: PG:: Undefined Table: error "[tablename]" does not exist on heroku rails migration

  26. 26

    "Operator does not exist: integer =?" when using Postgres

  27. 27

    Relation does not exist when trying to grant privileges

  28. 28

    "ERROR: role "$user" does not exist" when setting up postgresql server

  29. 29

    "ERROR: role "$user" does not exist" when setting up postgresql server

HotTag

Archive