如何在Debian的Postgres 10中使用scram-sha-256?获取“致命错误:密码身份验证失败”

mYn*_*EAm 4 authentication postgresql sasl-scram postgresql-10

我编辑了pg_hba.conf

sudo su postgres
nano /etc/postgresql/10/main/pg_hba.conf
Run Code Online (Sandbox Code Playgroud)

并添加以下行:

local   all             username                               scram-sha-256
Run Code Online (Sandbox Code Playgroud)

并且改变了这一切md5,以scram-sha-256在该文件中。

作为postgres用户,我创建了一个具有超级用户权限的新用户:

sudo su postgres
psql

CREATE USER username WITH SUPERUSER PASSWORD 'password';
Run Code Online (Sandbox Code Playgroud)

然后我重新启动了Postgres:

/etc/init.d/postgresql restart
Run Code Online (Sandbox Code Playgroud)

并尝试使用pgAdmin4登录,我在其中更改了数据库的Connection属性下的用户名。但是,无论如何,这都psql -U username testdb < ./testdb.sql不起作用:

严重:用户“用户名”的密码身份验证失败

那么如何在我的Debian9 / KDE机器上让Postgres使用scram-sha-256?早前工作时,我离开了所有md5pg_hba.conf原样。

Lau*_*lbe 6

精美的手册说:

要升级现有的安装md5scram-sha-256已经确保了所有正在使用的客户端库是新的,足以支持SCRAM,集之后,password_encryption = 'scram-sha-256'postgresql.conf,让所有用户设置新密码和身份验证方法更改规格pg_hba.confscram-sha-256

我想不出什么可以加倍说明的……