I'm using postgresql9.2 and OS Redhat6.9; While getting backup from postgresql database backup from command line found a error.
I'm using two command like
[root@clipntouch ~]# pg_dump -h localhost -U adempiere -W -F t live_3001 > database_dump_file.tar
or
[root@clipntouch ~]# pg_dump -U adempiere live_3001 | gzip > /home/database_dump_file.gz
Find 2 error-
1. For first one- pg_dump: [archiver (db)] connection to database "live_3001" failed: FATAL: password authentication failed for user "adempiere"
2. For second one- psql.bin: FATAL: password authentication failed for user "root"
Any best solution ?
The errors are very clear and verbose,
Error 1 : After you hit enter, you had to provide the password for the DB User, the password you typed was incorrect.
Error 2 : You didn't specify the parameter [-W] so it didn't ask for any password. This would work if the postgres server configuration was set to TRUST for localhost but the default configuration is always set to md5 or peer.
To solve this, all you need to do is to understand pg_dump tool.
Example: pg_dump -Fc -h localhost -d adempiere -U adempiere -v -W > file.backup
Understanding Parameters
-h It corresponds to Host where the database is located
-d Refers to the database you try to backup
-U It referes to the database user with backup privileges
-W This parameters let you type the database user password after you run the command
-Fc It allows you to generate a custom format file .backup
-v Verbose, It let you see the log of what is happening in the background.
You can find more information about this command in the following link: