postgresql - 如何在 Debian 的 Postgres 10 中使用 scram-sha-256?获取 "FATAL: password authentication failed"

标签 postgresql authentication postgresql-10 sasl-scram

我编辑了 pg_hba.conf :

sudo su postgres
nano /etc/postgresql/10/main/pg_hba.conf

并添加了这一行:

local   all             username                               scram-sha-256

并更改所有md5scram-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就像他们一样。

最佳答案

The fine manual说:

To upgrade an existing installation from md5 to scram-sha-256, after having ensured that all client libraries in use are new enough to support SCRAM, set password_encryption = 'scram-sha-256' in postgresql.conf, make all users set new passwords, and change the authentication method specifications in pg_hba.conf to scram-sha-256.

关于postgresql - 如何在 Debian 的 Postgres 10 中使用 scram-sha-256?获取 "FATAL: password authentication failed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53397531/

相关文章:

java - JPQL 的 INNER JOIN 问题(即使 SQL 请求正在运行)

postgresql - 如何替换列中的字符串,该字符串是另一个表中的外键

SQL 在重复键违规后继续执行查询

postgresql - 服务器版本不匹配 postgresql pg_dump

postgresql - CREATE TABLE AS 不允许在 Postgresql 的非 volatile 函数中使用

sql - 如何在 postgresql 中使用 “time” 字段按天和 2 小时分组?

java - 在 Linux 中使用 PostgreSQL 在基于 Java/Scala 的应用程序中访问(英语) 'dictionary' 的最快、最简单的方法?

powershell - 如何检测Azure Add-AzureAccount登录是否失败或被取消?

重定向后未设置 Django : request. 用户

android - 在Android中访问经过身份验证的图像的URL