如何解决 Postgresql SCRAM 身份验证问题? [英] How can I solve Postgresql SCRAM authentifcation problem?

查看:61
本文介绍了如何解决 Postgresql SCRAM 身份验证问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将项目移至生产环境后出现错误.用生产服务器运行时报错如下

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

pg_connect():无法连接到 PostgreSQL 服务器:SCRAM 身份验证需要 libpq 10 或更高版本.

这是我的 postgreSQL 版本:

Here is my postgreSQL version:

开发版本:

PostgreSQL 11.5 on x86_64-pc-linux-gnu,由 gcc (GCC) 4.8.5 编译 20150623(红帽 4.8.5-36),64 位

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

生产版本:

PostgreSQL 11.5 (EnterpriseDB Advanced Server 11.5.12) on x86_64-pc-linux-gnu,由 gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36) 编译,64 位

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

推荐答案

您的应用程序使用与 PostgreSQL 客户端 C 库 libpq 链接的 API.

Your application uses an API that is linked with the PostgreSQL client C library libpq.

该库的版本必须是 9.6 或更低版本,并且在 v10 中引入了 SCRAM 身份验证.

The version of that library must be 9.6 or older, and SCRAM authentication was introduced in v10.

升级libpq 在应用端并重试.

如果不需要scram-sha-256认证,可以恢复为md5:

If you don't need scram-sha-256 authentication, you can revert to md5:

  • postgresql.conf
  • 中设置password_encryption = md5
  • pg_hba_conf中的认证方式改为md5
  • 重新加载 PostgreSQL
  • 修改用户密码,获取MD5加密密码

这篇关于如何解决 Postgresql SCRAM 身份验证问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆