Postgresql 未对用户进行身份验证

Postgresql not authenticating a user

我在 Postgres 中创建了一个用户 "kylo" 并授予它超级用户权限。当我输入以下命令时,它不起作用:

您似乎输入了错误的密码:

尝试为用户创建新密码:kylo

ALTER USER user_name WITH PASSWORD 'new_password';

设置角色密码:

ALTER ROLE role_name WITH LOGIN PASSWORD 'password';

please note : (CREATE USER is the same as CREATE ROLE except that it implies LOGIN.)

此外,在您希望登录的特定数据库上授予 user/role 权限。

编辑:1

在 cli 上执行此命令以在您的情况下更改为普通用户 kylo如果使用 Ubuntu/CentOS 等:

sudo -i -u kylo #change to a user which is available to your system

尝试登录 psql,它可能有效。

即使这样问题还是没有解决 添加一个条目到pg_hba.conf可能位于/etc/postgresql/9.x/main下,如果不是运行这个命令就知道了位置 locate pg_hba.conf

之后,添加一个条目到 conf

local   all   kylo    trust

然后修改用户密码,将conf中的条目编辑为

local   all   kylo    md5

trust - anyone who can connect to the server is authorized to access the database

peer - use client's operating system user name as database user name to access it.

md5 - password-base authentication