How can I solve Postgresql SCRAM authentifcation problem?
Your application uses an API that is linked with the PostgreSQL client C library libpq
.
The version of that library must be 9.6 or older, and SCRAM authentication was introduced in v10.
Upgrade libpq
on the application end and try again.
If you don't need scram-sha-256
authentication, you can revert to md5
:
- set
password_encryption = md5
inpostgresql.conf
- change the authentication method to
md5
inpg_hba_conf
- reload PostgreSQL
- change the password of the user to get an MD5 encrypted password
I used to get an error SCRAM authentication requires libpq version 10 or above when running php artisan migrate
in laravel 8
. Then I fixed it as follows: Change authentication from scram-sha-256
to md5
, then reset your password
and restart the postgresql-x64-13 service
and here are step by step:
- Step 1: Find file
postgresql.conf
inC:\Program Files\PostgreSQL\13\data
then setpassword_encryption = md5
- Step 2: Find file
pg_hba.conf
inC:\Program Files\PostgreSQL\13\data
then change allMETHOD
tomd5
- Step 3: Open
command line (cmd,cmder,git bash...)
and runpsql -U postgres
then enter your password when installed postgres sql - Step 4: Then change your password by run
ALTER USER postgres WITH PASSWORD 'new-password'
in command line - Final: Restart service
postgresql-x64-13
in yourService
.
Encountered the same issue and applied @Laurenz Albe's fix but I would get an authentication error on my user for the database, because of encryption strategy change.
So instead of replacing scram-sha-256
with md5
, replace it with trust
in pg_hba.conf