Settings | Sign in | Sign up

The author has 3 posts.

org.postgresql.util.PSQLException: SCRAM authentication is not supported

Floor 1 巨大八爪鱼 10/30/24 23:08

javax.servlet.ServletException: org.postgresql.util.PSQLException: SCRAM authentication is not supported by this driver. You need JDK >= 8 and pgjdbc >= 42.2.0 (not ".jre" versions)


解決方案,將/var/lib/pgsql/data/postgresql.conf裡面的password_encryption = scram-sha-256改為password_encryption = md5,然後在psql命令行裡面用ALTER USER postgres PASSWORD語句再設一次postgres用戶的密碼。

Floor 2 巨大八爪鱼 10/30/24 23:10

在psql命令行中,可用show password_encryption命令查看當前password_encryption配置。

$ psql -U postgres -W
Password:
psql (15.6)
Type "help" for help.

postgres=# show password_encryption;
 password_encryption
---------------------
 scram-sha-256
(1 row)

postgres=# \q


默認是postgresql jdbc驅動不支持的scram-sha-256方式。

Floor 3 巨大八爪鱼 10/30/24 23:12

將/var/lib/pgsql/data/postgresql.conf裡面的password_encryption由scram-sha-256改為md5,重啟postgresql伺服器後在psql命令行中查看是否生效,然後再設置一遍postgres用戶(jdbc連接資料庫時使用的用戶)的密碼即可。

$ psql -U postgres -W

Password:
psql (15.6)
Type "help" for help.

postgres=# show password_encryption;
 password_encryption
---------------------
 md5
(1 row)

postgres=# ALTER USER postgres PASSWORD '密碼';
ALTER ROLE
postgres=# \q

Content converter:

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.