我已经安装了PostgreSQL 8.4, Postgres客户端和Pgadmin 3。控制台客户端和Pgadmin用户“postgres”身份验证失败。我已经输入用户作为“postgres”和密码“postgres”,因为它以前工作过。但是现在身份验证失败。我以前做过几次都没有这个问题。我该怎么办?发生了什么?

psql -U postgres -h localhost -W
Password for user postgres: 
psql: FATAL:  password authentication failed for user "postgres"
FATAL:  password authentication failed for user "postgres"

当前回答

以下是我尝试登录的一些组合:

# login via user foo
psql -Ufoo -h localhost

sudo -u postgres psql postgres

# user foo login to postgres db
psql -Ufoo -h localhost -d postgres

其他回答

遵循以下步骤:

Sudo -u postgres -i psql postgres \密码

之后,输入两次密码。

然后在pgAdmin4中使用该密码。

我也遇到过类似的问题。 Ubuntu让我用超级用户的任何密码登录控制台。 除了我在psql行命令中连接-h localhost。

我还观察到“localhost:8080/MyJSPSiteLogIn”-显示:致命:用户“user”的autentication错误。

Pg_hba.conf是ok的。

我注意到在同一个服务中运行了两个版本的postgres。

解决-卸载inutil版本。

首先是密码箱

ALTER USER postgres with encrypted password 'postgres';

然后重启服务:

sudo systemctl restart postgresql.service

End.

尽量不要使用-W参数,并让密码为空。有时创建用户时使用无密码。

如果不行,重置密码。有几种方法可以做到这一点,但这适用于许多系统:

$ su root
$ su postgres
$ psql -h localhost
> ALTER USER postgres with password 'YourNewPassword';

我也遇到过类似的问题。 而访问任何数据库,我得到以下提示后更新密码 " PGAdmin中postgres用户密码认证失败"


解决方案:

关闭postgres服务器 重新运行pgadmin Pgadmin会要求输入密码。 请输入上述用户当前密码

希望它能解决你的问题