no pg_hba.conf entry for host no pg_hba.conf entry for host postgresql postgresql

no pg_hba.conf entry for host


If you can change this line:

host    all        all         192.168.0.1/32        md5

With this:

host    all        all         all                   md5

You can see if this solves the problem.

But another consideration is your postgresql port(5432) is very open to password attacks with hackers (maybe they can brute force the password). You can change your postgresql port 5432 to '33333' or another value, so they can't know this configuration.


In your pg_hba.conf file, I see some incorrect and confusing lines:

# fine, this allows all dbs, all users, to be trusted from 192.168.0.1/32# not recommend because of the lax permissionshost    all        all         192.168.0.1/32        trust# wrong, /128 is an invalid netmask for ipv4, this line should be removedhost    all        all         192.168.0.1/128       trust# this conflicts with the first line# it says that that the password should be md5 and not plaintext# I think the first line should be removedhost    all        all         192.168.0.1/32        md5# this is fine except is it unnecessary because of the previous line# which allows any user and any database to connect with md5 passwordhost    chaosLRdb  postgres    192.168.0.1/32        md5# wrong, on local lines, an IP cannot be specified# remove the 4th columnlocal   all        all         192.168.0.1/32        trust

I suspect that if you md5'd the password, this might work if you trim the lines. To get the md5 you can use perl or the following shell script:

 echo -n 'chaos123' | md5sum > d6766c33ba6cf0bb249b37151b068f10  -

So then your connect line would like something like:

my $dbh = DBI->connect("DBI:PgPP:database=chaosLRdb;host=192.168.0.1;port=5433",    "chaosuser", "d6766c33ba6cf0bb249b37151b068f10");

For more information, here's the documentation of postgres 8.X's pg_hba.conf file.


Your postgres server configuration seems correct

host    all         all         127.0.0.1/32          md5host    all         all         192.168.0.1/32        trust
That should grant access from the client to the postgres server. So that leads me to believe the username / password is whats failing.

Test this by creating a specific user for that database

createuser -a -d -W -U postgres chaosuser

Then adjust your perl script to use the newly created user

my $dbh = DBI->connect("DBI:PgPP:database=chaosLRdb;host=192.168.0.1;port=5433", "chaosuser", "chaos123");