How can I solve Postgresql SCRAM authentifcation problem?

老子叫甜甜 提交于 2021-02-16 10:30:34

问题


I am getting an error after moving the project to production. The error is as follows while running with production server

pg_connect(): Unable to connect to PostgreSQL server: SCRAM authentication requires libpq version 10 or above.

Here is my postgreSQL version:

Development Version :

PostgreSQL 11.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit

Production Version :

PostgreSQL 11.5 (EnterpriseDB Advanced Server 11.5.12) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit


回答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 in postgresql.conf
  • change the authentication method to md5 in pg_hba_conf
  • reload PostgreSQL
  • change the password of the user to get an MD5 encrypted password



回答2:


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




回答3:


For windows, postgresql Version 13 seems to show this error. The easy way out is to install postgresql version 12.5 is instead. https://www.enterprisedb.com/downloads/postgres-postgresql-downloads



来源:https://stackoverflow.com/questions/62807717/how-can-i-solve-postgresql-scram-authentifcation-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!