$ ps -ef | grep postgres
postgres 3940 1 0 12:38 ? 00:00:00 /usr/lib/postgresql/8.4/bin/postgres -D /var/lib/postgresql/8.4/main -c config_file=/etc/postgresql/8.4/main/postgresql.conf
$ grep 'hba_file' /etc/postgresql/8.4/main/postgresql.conf
hba_file = '/etc/postgresql/8.4/main/pg_hba.conf' # host-based authentication file
# vi /etc/postgresql/8.4/main/pg_hba.conf
OR:
# vi $(grep 'hba_file' $(ps -ef | grep postgres | awk '{ if ( $3 == 1 ) print $NF }' | cut -d '=' -f 2) | cut -d "'" -f 2)
#local all postgres md5
local all postgres trust
# service postgresql-8.4 restart
# su - postgres
$ psql -d template1 -U postgres
> alter user postgres with password 'new_password';
# vi /etc/postgresql/8.4/main/pg_hba.conf
OR:
# vi $(grep 'hba_file' $(ps -ef | grep postgres | awk '{ if ( $3 == 1 ) print $NF }' | cut -d '=' -f 2) | cut -d "'" -f 2)
local all postgres md5
#local all postgres trust
# service postgresql-8.4 restart
$ psql -d template1 -U postgres