Postgres give an error of 'Password Authentication failed for user'


Make sure the password is in /var/lib/pgsql/.pgpass 
  
 The format is as follows… 
  
 *:*:*:postgres:PASSWORD 
  
 Modify /var/lib/pgsql/data/pg_hba.conf 
  
 It should contain the following… 
  
 local   all         all                                              md5 
 host    all         all         127.0.0.1          255.255.255.255   md5 
  
 Change ‘md5’ to ‘trust’ to disable authentication then restart postgres. 
  
 `/etc/init.d/postgresql restart` 
  
 Now you should be able to connect to postgresql as user ‘postgres’ without a password to modify the password. 
  
 `psql -u template1` 
  
 Run the following sql command. 
  
 “alter user postgres with password ‘NEW PASSWORD HERE’;” 
  
 Finally change /var/lib/pgsql/data/pg_hba.conf back to its original format and restart postgresql one more time. Now you should be able to authenticate using user postgres and the password you specified.
Your rating: None