From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | Daniele Varrazzo <daniele(dot)varrazzo(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 16:17:57 |
Message-ID: | 4D94A935.1000701@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On 03/31/2011 07:56 AM, Daniele Varrazzo wrote:
> 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.
Got you, so it not that localhost is not allowed, but that an explicit
IP address eliminates a possible bug.
>
> 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
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | nishikawahdk | 2011-04-05 09:09:50 | psycopg and the GPL |
Previous Message | Daniele Varrazzo | 2011-03-31 14:56:14 | Re: Please Help me with connecting my PostgreSQL |