我已经安装了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"

当前回答

我只是想补充一句,你也应该检查一下你的密码是否过期了。

详细信息请参见Postgres密码验证失败。

其他回答

工作人员的反应是正确的,但如果你想进一步自动化可以做:

$ sudo -u postgres psql -c “ALTER USER postgres PASSWORD 'postgres' ;”

完成了!您保存了User = postgres和password = postgres。

如果你没有postgres ubuntu用户的密码,请:

$ sudo passwd postgres

在我的例子中,Ubuntu 20.04 Postgresql 12使用了错误的端口。

我检查了/etc/postgresql/12/main/postgresql.conf,发现它是5433而不是5432。

首先是密码箱

ALTER USER postgres with encrypted password 'postgres';

然后重启服务:

sudo systemctl restart postgresql.service

End.

如果您试图以postgres用户登录postgres shell,那么您可以使用以下命令。

切换到postgres用户

# su - postgres

登录PSQL

# psql

希望这能有所帮助

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


解决方案:

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

希望它能解决你的问题