我编辑了 pg_hba.conf
:
sudo su postgres
nano /etc/postgresql/10/main/pg_hba.conf
并添加了这一行:
local all username scram-sha-256
并更改所有md5
至 scram-sha-256
在该文件中。
作为 postgres
用户,我创建了一个具有 super 用户权限的新用户:
sudo su postgres
psql
CREATE USER username WITH SUPERUSER PASSWORD 'password';
然后我重新启动了 Postgres:
/etc/init.d/postgresql restart
并尝试使用 pgAdmin4 登录,我在其中更改了数据库连接属性下的用户名。但那和psql -U username testdb < ./testdb.sql
都不是按照我的要求工作:
FATAL: password authentication failed for user "username"
那么如何让 Postgres 在我的 Debian9/KDE 机器上使用 scram-sha-256?当我离开所有 md5
时它工作得更早在pg_hba.conf
就像他们一样。
最佳答案
To upgrade an existing installation from
md5
toscram-sha-256
, after having ensured that all client libraries in use are new enough to support SCRAM, setpassword_encryption = 'scram-sha-256'
inpostgresql.conf
, make all users set new passwords, and change the authentication method specifications inpg_hba.conf
toscram-sha-256
.
关于postgresql - 如何在 Debian 的 Postgres 10 中使用 scram-sha-256?获取 "FATAL: password authentication failed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53397531/