Centos postgres连接

时间:2017-03-10 07:57:05

标签: postgresql centos centos6 postgresql-9.3

当您尝试连接到postgres时:

# psql -h localhost dgrt postgres
I get an error:
#User "postgres" has not passed authentication (Ident)

配置我的文件 postgresql.conf中:

listen_addresses = '*'

的pg_hba.conf:

#Allow replication connections from localhost, by a user with the
#replication privilege.

host    all             all             127.0.0.1/32            ident

1 个答案:

答案 0 :(得分:1)

使用ident auth,您需要以正确的OS用户身份启动命令,即数据库用户名必须与本地主机上的OS用户名匹配。

例如(作为root)你可以这样做:

# su postgres -c 'psql dgrt'

这同样适用于与远程主机的连接。有关详细信息,请参阅文档。

供参考: