I recently installed Postgre version 10 on a linux red hat. I'm trying to configure that psql will prompt a user for password when accessing the database. After changing everything to scram-sha-256. I'm getting this error when accessing psql
psql: FATAL: password authentication failed for user "postgres"
Any idea how can I fix this? Thanks!
CodePudding user response:
Postgres store password md5 format as default. If you want to change password encryption you have to follow bellow solution:
P.S: Before start, You have to undo pg_hba.conf file authenticate method to md5
- Edit
postgresql.confand changepassword_encryptionto
password_encryption = scram-sha-256
Restart Postgres service (or reload service)
reset the user password
# if use psql cli
\password <user>
# If use SQL command
alter user <user> with password '<password>';
- After updating all passwords you should change
pg_hba.confauthenticate method to scram-sha-256 and reset service again
Reference: Information about upgrade postgres password authenicate

