I have installed PostgreSQL server 8.4 on my CentOS server sucessfully. After that, I login to CentOS server by using 'postgres' user, but I can not run any command, the error occur:
password authentication failed for user "postgres"
Here is some configurations in pg_hba.conf and postgresql.conf:
--------------------configuration in postgresql.conf-----------
listen_addresses = '*'
--------------------configuration in pg_hba.conf---------------
local all all md5
local all postgres md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
I tend to use the following in pg_hba.conf:
# Database administrative login by UNIX sockets
local all postgres ident
# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
That means that once you're "postgres", you don't need a password, but you need sudo rights to become postgres, so that's pretty darn secure. Any other user can login using simple md5 authentication, which means you don't have to sudo all over the place. This works well for me.
Ensure you use the password of the postgres PostgreSQL account, not the postgres system account. Try "trust" instead of "md5" in the pg_hba.conf to connect to the db an change your pass.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With