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

Re: no pg_hba.conf entry for host

From: mike g <mike(at)thegodshalls(dot)com>
To: - Barry - <mail(at)polisource(dot)com>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: no pg_hba.conf entry for host
Date: 2004-06-20 04:01:58
Message-ID: 1087704118.23312.35.camel@localhost.localdomain (view raw, whole thread or download thread mbox)
Lists: pgsql-cygwin
pg_hba.conf is configured to allow connections only from the pc the
database is installed on initially.  Only one login account exists by
default after a new installation and that is the postgres account. 
Until you connect to the db the first time using the postgres account
and create new users accounts will you have the option of using your
Owner account.  

For connecting from another windows pc other than the one postgres is
running on the default postgresql.conf file must be modified before
modifying pg_hba.conf.  Within postgresql.conf there is an entry
commented out, tcpip_socket = false, uncomment that line and change it
to equal true.  
Now you can modify the pg_hba.conf.  Add a new line to that reads the

host      all       all         XXX  trust

XXX = the ip address of the computer that your application is running
on.  If your ip address is say it is ok to enter it in
pg_hba.conf as  The .0 acts a wildcard in case your
computer is assigned a new ip address at a later time (hopefully it will
be in the same range as the original...)

Once the above is done you can reboot the computer to stop and restart

Before using your application to connect to postgres might I suggest
that you use pgadminIII to connect to it first.  PgadminIII is a
graphical program specifically designed to access postgres, create users
/ tables / databases, issue commands etc.  A graphical program can save
you the trouble of having to learn some of the sql.  PgAdminIII can be
downloaded freely from  If you choose this the
new connection to create within pgadmin would use a login of postgres,
select the trusted connection box, and you should connect.

Once the above is done with or without getting pgadminIII then modify
your windows ODBC connection to use the postgres account.
The userid would be postgres.  No password would be needed.  Your ODBC
connection will require a name of a database to connect to initially
however.  The only one that exists by default is template1.  Template1
is a system database and not to be used to store your applications data
in.  You really should create another database within postgres that your
application will write to.  You can use pgadminIII to do that with a few

Hope that helps.  

There are some books on postgresql out there that you can get which
might help as well.

In addition there is a mailing list on specifically
for novice users which might help as well.


On Sat, 2004-06-19 at 05:47, - Barry - wrote:
> This is in part a diary entry, since I'm no longer so enthused or optimistic
> about getting this to work, or whether it's practical for me.
> I reread some instructions I got on this list, and decided to give them a
> try. I configured Windows for an ODBC connection, possibly correctly. From
> the very start, it wasn't clear to me which user's account information
> needed to be used and altered, the Owner's or postgres's. The file pg_hba
> seemed to be configured to allow everything, according to the docs, so I
> didn't change it, but I got the fatal "no pg_hba.config entry" error. Then I
> tried creating a pg_hba.config file for the Owner's account, which I intend
> to access the database from. After I rebooted, permission was denied for the
> whole /var/postgresql/ folder for the user Owner, and I still got the fatal
> error. Then I went to the postgres user's account and saw that my edits to
> pg_hba.config weren't there, but I was able to edit the file, so I did. I
> rebooted, and still got the fatal error from both accounts.
> The only edit I made to /var/postgresql/ was to replace the "" from
> "host    all         all   trust"
> with the IP address I saw in the error message. Maybe I needed to replace
> the mask too, but the only mask I saw at the command line was a subnet mask
> (, not an IP-mask. In fact, I think there were two different
> ones, along with two different IP Addresses. I used the one under "Ethernet
> adapter local area connection." The other title and entries aren't there at
> the moment for some reason.
> Still seems like this should be easier. Since this is for a product I might
> sell, I think I should be looking at something more commercial that includes
> an installer to make it easier for others, even if I myself am masochistic.
> More likely, I'll use flat files. Wouldn't be so bad for my purposes anyway.
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to


pgsql-cygwin by date

Next:From: mike gDate: 2004-06-20 05:35:58
Subject: Re: Query about
Previous:From: - Barry -Date: 2004-06-19 10:47:47
Subject: no pg_hba.conf entry for host

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