Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm using ubuntu OS and I took backup using

sudo -u postgres pg_dump dbname | gzip > filename.gz

in the file path as...

/home/administrator/Documents/DB_Backup# sudo -u postgres pg_dump dbname | gzip > filename.gz

Later, I tried to restore it back using these following below...

 1. gunzip -c filename.gz | psql glialmine
 2. cat filename.gz | gunzip | psql
 3. sudo -u postgres  psql pg_restore -d dbname  filename.gz

all these 3 restore option I used asks password, but I have only one login and I tried it and its not accepting it I also tried root password and linux login password too but its not working.

For first two it asks password like below

Password:
psql: fe_sendauth: no password supplied

and for 3rd one it asks password and its error for my password like below

 Password for user pg_restore: 
 psql: FATAL:  password authentication failed for user "pg_restore"
share|improve this question

migrated from stackoverflow.com Nov 21 '12 at 18:37

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Find the postgresql installation folder containing pg_hba.conf. Edit the authentication chapter at the end of this file, adding

local   all         all                               trust
host    all         all         127.0.0.1/32          trust
host    all         all         ::1/128               trust

and restart. After that postgresql should not ask for the password to authenticate into any account if this is done from the same machine where the postgresql server is running.

Afterwards, change passwords to be sure you know them. Finally, remove the added lines from pg_hba.conf for more security. You can only bypass authentication because you already have root rights on that computer.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.