How can I solve Postgresql SCRAM authentifcation problem?
Solution 1:
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
Solution 2:
For those on M1-Based macs who are currently seeing this issue in docker - there appears to a bug upstream in libpg that's building against the wrong library version on ARM.
Until it's fixed, a workaround is to (at a performance hit) is to just run it via rosetta.
export DOCKER_DEFAULT_PLATFORM=linux/amd64
, and re-build your images.
You'll get the latest version of libpq, and things should Just Work.
Ref: https://issueexplorer.com/issue/psycopg/psycopg2/1360