1

I'm using PostgreSQL 9.1 on an Ubuntu 12.04 server. The database instance seems to run fine in general and when I try and connect from pgAdmin III via localhost on the server machine itself, there is no problem.

Whenever I try to use the LAN address 192.168.1.16 from the server, I get the error "Access to database denied."

From what I gather, the common culprit in these sorts of situations seems to be the configuration described in the pg_hba.conf file, which currently contains the following:

host all all 192.168.0.1/32 md5

As far as I understand, the instance should accept all users. Is there anything I'm missing here?

4

1 回答 1

1

请注意,您正在尝试从 连接192.168.1.16,但是,您pg_hba.conf只允许192.168.0.1(这就是/32意思)。

检查https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#IPv4_CIDR_blocks以了解有关 CIDR 表示法的更多信息。

如果您只想允许192.168.1.16,您可以在您的 : 添加以下行pg_hba.conf

host all all 192.168.0.16/32 md5

然后,运行pg_ctl reload以应用上面所做的更改。

此答案假设您已验证文件listen_address中的参数postgresql.conf并且它绑定了正确的 IP 值。

于 2013-04-30T02:18:47.937 回答