changing passwd

June 4, 2007

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.

Entry Filed under: PostgreSQL. .


Meta

Blogroll

 

June 2007
M T W T F S S
« May    
 123
45678910
11121314151617
18192021222324
252627282930