Re: Please Help me with connecting my PostgreSQL

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
Cc: psycopg(at)postgresql(dot)org, Lasntonpeng <lanstonpeng(at)gmail(dot)com>, psycopg-owner(at)postgresql(dot)org
Subject: Re: Please Help me with connecting my PostgreSQL
Date: 2011-03-31 14:56:14
Message-ID: AANLkTi=PMV2MmWZsRuLB625jz6THXxbjv5KVcgpoShrP@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Thu, Mar 31, 2011 at 3:07 PM, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)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

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Adrian Klaver 2011-03-31 16:17:57 Re: Please Help me with connecting my PostgreSQL
Previous Message Adrian Klaver 2011-03-31 14:15:40 Re: Please Help me with connecting my PostgreSQL