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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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
following:

host all all XXX 255.255.255.255 trust

XXX = the ip address of the computer that your application is running
on. If your ip address is say 192.168.123.250 it is ok to enter it in
pg_hba.conf as 192.168.123.0. 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
postgres.

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 http://www.pgadmin.org 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
clicks.

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 www.postgresql.org specifically
for novice users which might help as well.

Mike

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 "127.0.0.1" from
> "host all all 127.0.0.1 255.255.255.255 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
> (255.255.255.0), 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

Responses

Browse pgsql-cygwin by date

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