Re: Please Help me with connecting my PostgreSQL - Mailing list psycopg

From Daniele Varrazzo
Subject Re: Please Help me with connecting my PostgreSQL
Date
Msg-id AANLkTi=PMV2MmWZsRuLB625jz6THXxbjv5KVcgpoShrP@mail.gmail.com
Whole thread Raw
In response to Re: Please Help me with connecting my PostgreSQL  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: Please Help me with connecting my PostgreSQL  (Adrian Klaver <adrian.klaver@gmail.com>)
List psycopg
On Thu, Mar 31, 2011 at 3:07 PM, Adrian Klaver <adrian.klaver@gmail.com> wrote:
> On Thursday, March 31, 2011 6:42:35 am Daniele Varrazzo wrote:
>
>>
>> To connect to a database on the local machine, the quick answer is:
>> add host=127.0.0.1 to the connection string, which makes it connect to
>> the network socket instead of the unix socket. And I mean "127.0.0.1",
>> not "localhost".
>
> localhost works also:)

Sometimes I've been bitten by a badly configured /etc/hosts and/or
pg_hba.conf, and if localhost doesn't resolve to 127.0.0.1 in both
directions (not granted when both IPv4 and IPv6 enabled) the
connection will fail, or the wrong pg_hba rule may be used.

Of course it doesn't happen on a well configured server, but because
the OP is in "shotgun debugging" mode, as the 5433 typo shows,
avoiding the use of a name to be solved is an element less that may
fail.

More details are in the box at
http://developer.postgresql.org/pgdocs/postgres/auth-pg-hba-conf.html#AEN30140

-- Daniele

psycopg by date:

Previous
From: David Blewett
Date:
Subject: Re: Please Help me with connecting my PostgreSQL
Next
From: Adrian Klaver
Date:
Subject: Re: Please Help me with connecting my PostgreSQL