Postgres pg_hba.conf

时间:2013-12-05 05:52:32

标签: ruby-on-rails postgresql

当我们运行postgres安装后,我的一个客户端正在设置服务器 我们遇到以下错误的服务器。当我为它调整时,有一些解决方案可用,但没有一个对我有用,你能不能看一下并说出发生了什么。

Status: 500 Internal Server Error
FATAL:  no pg_hba.conf entry for host "127.0.0.1", user "syr_admin", database     "allprosh_production", SSL off

我的pg_hba.conf文件:

local all  all      md5
host samerole all  127.0.0.200   255.255.255.255   pam  pamservice=postgresql_cpses
host samerole all  127.0.0.1   255.255.255.255   md5
local all postgres        md5
host all postgres  127.0.0.1   255.255.255.255   md5
local   all     all     trust  

先谢谢。

4 个答案:

答案 0 :(得分:7)

我自己想通了,虽然花了很长时间。解决方案很简单,我只需要在pg_hba.conf文件中为该特定用户添加一个条目。这就是我所做的:

local all syr_admin  md5
host all syr_admin 127.0.0.1   255.255.255.255   md5

希望这有助于其他人......: - )

答案 1 :(得分:3)

我认为正确的配置是:

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
host    all             all             0.0.0.0/0               md5

如果您想通过其他网络连接使用:

host    all             all             network address/32            md5

使用两个八位位组192.159.0.0例如

答案 2 :(得分:2)

我在这里回复是因为我无法评论您的解决方案。

仅将该条目添加到该特定用户并非强制要求。您可以将“samerole”选项替换为数据库或全部。

我看到你所拥有的两条线相互碰撞。

local all  all      md5
local   all     all     trust  

在这种情况下,最后一行获胜,因此请小心在访问方法上添加意外行为。如果要在本地询问Universe的密码,则必须删除最后一行。

希望这有帮助!

答案 3 :(得分:0)

对于用户 postgres 的PostgreSQL上的localhost身份验证,你的hba.conf必须有这一行:

# IPv6 local connections:
host    all             postgres             ::1/128             trust

可以肯定的是,你可以添加另一行:

# IPv4 local connections:
host    all             postgres          127.0.0.1/32           trust

注意:您可以将方法ao authentification从trust更改为md5。

相关问题