For When You Can't Have The Real Thing
[ start | index | login ]
start > postgresql > change root password

change root password

Created by dave. Last edited by dave, 8 years and 233 days ago. Viewed 3,235 times. #2
[diff] [history] [edit] [rdf]
labels
attachments

Change Root Password

...if you don't know it.

The "root" or superuser for postgresql is the user that the server runs as. To set this password if it is unset:

$ psql -U postgres -d template1
template1=# alter user postgres with encrypted password 'yourpassword';
template1=# q

If the password is already set, you can't run psql. To temporarily grant password-less access:

Add this line in pg_hba.conf (for v7):

local all all trust

...for v8:

local all postgres 127.0.0.1/32 trust

...then restart postgres. Then run the psql line above. Then remove the line from pg_hba.conf, and restart postgres again.

no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt