Postgresql Centos postgres connect
当您尝试连接到postgres时:Postgresql Centos postgres connect,postgresql,centos,centos6,postgresql-9.3,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
# 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
使用
ident
auth,您需要以正确的操作系统用户身份启动命令,即数据库用户名必须与本地主机上的操作系统用户名匹配
例如(作为root用户),您可以执行以下操作:
# su postgres -c 'psql dgrt'
这同样适用于到远程主机的连接。有关详细信息,请参阅文档
供参考:
ident
时,使用了peer
这意味着您的操作系统用户应该匹配postgres,因此,要以postgres身份登录db,您必须是os上的postgres#更新2:我需要连接到远程服务器而不是本地服务器#psql-h 10.10.10.2 dgrt postgres在这个cacepsql-h localhost
中引用的hba#u conf行是不相关的