我成功地在我的PostgreSQL服务器上安装了CentOS服务器8.4。之后,我使用'postgres‘用户登录到CentOS服务器,但无法运行任何命令,出现以下错误:
用户"postgres“的
密码身份验证失败
下面是pg_hba.conf和postgresql.conf中的一些配置:
--------------------configuration in postgresql.conf-----------
listen_addresses = '*'
--------------------configuration in pg_hba.conf---------------
local all all md5
local all postgres md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5发布于 2011-08-12 09:59:41
我倾向于在pg_hba.conf中使用以下内容:
# Database administrative login by UNIX sockets
local all postgres ident
# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5这意味着一旦你成为"postgres",你就不需要密码,但是你需要sudo权限才能成为postgres,所以这是相当安全的。任何其他用户都可以使用简单的md5身份验证登录,这意味着您不必在任何地方都这样做。这对我很管用。
发布于 2011-08-12 09:54:25
确保您使用postgres PostgreSQL帐户的密码,而不是postgres系统帐户的密码。尝试“信任”而不是"md5“在pg_hba.conf中连接到db,更改您的通行证。
发布于 2011-11-12 10:33:26
我遇到了一个类似的问题(同样的错误信息)。就像丹尼尔的回答,这是因为我混淆了:
"postgres PostgreSQL帐户,而不是postgres系统帐户。
要确定postgres密码,只需将其更改为“123456”(或任何其他密码)即可。
# su postgres
# psql -d template1
template1=# ALTER USER postgres WITH PASSWORD '123456';https://stackoverflow.com/questions/7038342
复制相似问题