用户“postgres”的密码认证失败。 [英] password authentication failed for user "postgres"
问题描述
我已经在我的CentOS服务器上成功安装了PostgreSQL服务器8.4。
之后,我使用'postgres'用户登录到CentOS服务器,但我不能运行任何命令,错误发生:
I have installed PostgreSQL server 8.4 on my CentOS server sucessfully. After that, I login to CentOS server by using 'postgres' user, but I can not run any command, the error occur:
用户postgres的密码验证失败
password authentication failed for user "postgres"
以下是pg_hba.conf和postgresql.conf中的一些配置:
Here is some configurations in pg_hba.conf and 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
推荐答案
下面的pg_hba.conf中:
I tend to use the following in 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身份验证登录,这意味着您不必在所有地方sudo。这对我来说很好。
That means that once you're "postgres", you don't need a password, but you need sudo rights to become postgres, so that's pretty darn secure. Any other user can login using simple md5 authentication, which means you don't have to sudo all over the place. This works well for me.
这篇关于用户“postgres”的密码认证失败。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!