简体   繁体   English

Postgres:丢失或错误的pg_hba.conf文件

[英]Postgres: missing or erroneous pg_hba.conf file

I have 2 machines sitting on my desk and connected to the same IP network. 我有2台机器坐在我的桌子上并连接到同一个IP网络。 I'm trying to connect an application from one machine to the postgres database on the other. 我正在尝试将应用程序从一台机器连接到另一台机器上的postgres数据库。 At first the host with the application on it was giving me the PSQLException: 首先,带有应用程序的主机给我PSQLException:

FATAL: no pg_hba.conf entry for host "192.168.1.18", user "user1", database "test", SSL off

So I edited my pg_hba.conf file to accept the IP address: 192.168.1.18, by adding the line below at the end of the file: 所以我编辑了我的pg_hba.conf文件以接受IP地址:192.168.1.18,在文件末尾添加以下行:

host    pnp         all         192.168.1.18      trust

Then I got another type of error message: 然后我得到另一种类型的错误消息:

FATAL: missing or erroneous pg_hba.conf file

Is there anything I'm missing here? 这里有什么我想念的吗?

Thanks, Lancelot 谢谢,兰斯洛特

You have to specify the netmask of the host too. 您还必须指定主机的网络掩码。 So either " 192.168.1.18/32 " or " 192.168.1.18 255.255.255.255 " instead of the bare IP address. 所以要么“ 192.168.1.18/32 ”或“ 192.168.1.18 255.255.255.255 ”而不是裸IP地址。

See the pg_hba.conf file chapter in the online manual for details. 有关详细信息,请参阅联机手册中的pg_hba.conf文件章节。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM