Skip site navigation (1) Skip section navigation (2)

Re: no pg_hba.conf entry for host

From: "- Barry -" <mail(at)polisource(dot)com>
To: <mike(at)thegodshalls(dot)com>
Cc: <pgsql-cygwin(at)postgresql(dot)org>
Subject: Re: no pg_hba.conf entry for host
Date: 2004-06-21 05:31:41
Message-ID: 000601c45751$0c761810$2f01a8c0@Seka (view raw, whole thread or download thread mbox)
Lists: pgsql-cygwin
Hi Mike

>Within postgresql.conf there is an entry
> commented out, tcpip_socket = false, uncomment that line and change it
> to equal true.

I forgot to mention that I did that, except I kept the "false" line as a
comment and added an uncommented "true" version. I also added the following
line to pg_hba.conf:
host      all       all         XXX  trust
in which XXX is the ip address of my computer (the one listed under ethernet
adapter local area connection when I entered "ipconfig" at the command
prompt--not the one listed under PPP adapter). I might have changed
pg_hba.conf first, but as user postgres I changed both before I tried my
database-accessing Perl code. Then I got the error "no pg_hba.conf entry for
host" and checked those config files and they were still set correctly, and
that's when I made my previous post to this list, then uninstalled the ODBC
server and undid Windows' ODBC settings and gave up after a week of

The description of the "no pg_hba.conf entry for host" might be a little
misleading. It says:
19.3. Authentication problems
Genuine authentication failures and related problems generally manifest
themselves through error messages like the following.
FATAL:  no pg_hba.conf entry for host "", user "andym",
database "testdb"
This is what you are most likely to get if you succeed in contacting the
server, but it does not want to talk to you. As the message suggests, the
server refused the connection request because it found no authorizing entry
in its pg_hba.conf configuration file.
As I said, pg_hba.conf contained the authorizing entry, assuming I used the
correct IP address of the two that the ipconfig showed me, and there's no
way to choose a user name or database in that file, though I got that error
from both users' accounts. Maybe the error was due to the database getting
corrupted because I later tried accessing the psql command prompt interface
with "psql -U postgres template1" and it didn't work as it had in the past.
Or maybe I had to delete one of the files (data maybe?), which appeared to
solve one of the numerous problems of the past, but I no longer remember
where I found that tip (the information I needed just to reach this level of
failure was scattered all over). Or maybe I needed to "start the database
server using /usr/bin/postmaster -D /usr/local/pgsql/data" as the command
prompt told me after one of the configuration steps, before trying my
script, though you said I could "Once the above is done you can reboot the
computer to stop and restart postgres." and I did reboot before getting that

I can't tell you how good it feels now that I'm past all this and am doing
things the way I was strongly advised not to--by using the Perl script:
$Cygwin_Addr = 'c:\cygwin\cygwin.bat';
open(Chan, "|$Cygwin_Addr");
print Chan "psql -U postgres template1";
That appears to work. Soon I'll create a database other than template1, as
you mentioned I should, and see if I could add some print statements to the
above script for simple writing to and reading from the database. I'd use a
GUI, but this needs to be done programmatically. It seems like one benefit
of this method is, if for some reason me or any users of my product want to
access the database manually with psql at the command prompt, the exact
same, prewritten commands that I write for the script could be used.

Thanks again for the help, even if I'm going in a slightly different
direction for now.


In response to

pgsql-cygwin by date

Next:From: - Barry -Date: 2004-06-21 10:04:48
Subject: Re: no pg_hba.conf entry for host
Previous:From: mike gDate: 2004-06-21 04:50:56
Subject: Re: Problem with initdb

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group