我正在尝试使用 JDBC 驱动程序 42.2.20(最新版本)连接到 PostgreSQL-13 服务器,但用户身份验证失败,如下面的日志消息所示。
2021-05-22 23:19:07.519 IST [3070] testuser@testdb FATAL: password authentication failed for user "testuser"
2021-05-22 23:19:07.519 IST [3070] testuser@testdb DETAIL: Connection matched pg_hba.conf line 97: "host all all 127.0.0.1/32 scram-sha-256"
但是,我可以使用 psql 使用相同的凭据登录,如下面的日志消息所示。
2021-05-22 23:29:08.024 IST [3757] [unknown]@[unknown] LOG: connection received: host=[local]
2021-05-22 23:29:08.030 IST [3757] testuser@testdb LOG: connection authorized: user=testuser database=testdb application_name=psql
本地和主机都使用 scram-sha-256 对此用户进行身份验证。 几天前,这在同一台机器上运行(Ubuntu 桌面 20.04)。