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):
...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.