Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres: missing or erroneous pg_hba.conf file

I have 2 machines sitting on my desk and connected to the same IP network. I'm trying to connect an application from one machine to the postgres database on the other. At first the host with the application on it was giving me the 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:

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

like image 673
Lancelot Avatar asked Apr 13 '09 19:04

Lancelot


1 Answers

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.

See the pg_hba.conf file chapter in the online manual for details.

like image 100
David Schmitt Avatar answered Nov 17 '22 16:11

David Schmitt