How to restore a PostgreSQL database to a local
Not solved Solved
12 months ago

Hi guys,

I am trying to get a backup of the database of my production environnement and to use it in local to run some test. To do so I just followed Heroku's doc about importing and exporting Postgre db with pg_backups.

When I try this command:

$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgre -d ridelocalspot_development latest.dump

I have to enter the password for the user 'postgre' but i don't know where to find it. Do you have any ideas how to find this passsword ? If you know a better way to restore my .dump, please let me know.


12 months ago

You can also try this one

12 months ago

You can also find your password by going on your app dashboard, then clicking on the Postgres plan you've paired with it. You can then scroll down to the Database Credentials part, and your password you'll finally see :p

12 months ago

I got the same problem in both ways :

createdb: could not connect to database template1: FATAL:  password authentication failed for user "william"
FATAL:  password authentication failed for user "william
12 months ago

I just tried : sudo -u postgres psql (ubuntu user here) and postgres=# \du to list all my postgre users and i found these ones :

Role name | List of roles Attributes | Member of

  • william | Create DB | blank

  • postgres | Superuser, Create role, Create DB, Replication | blank

  • XXXX | Create DB | blank

Should I have to delete user "william" in order to make my pg:pull command work ?

Submit your answer