Re: Connection problems with "psql -h localhost postgres" - Mailing list pgsql-novice

From Tom Lane
Subject Re: Connection problems with "psql -h localhost postgres"
Date
Msg-id 18572.1115047044@sss.pgh.pa.us
Whole thread Raw
In response to Connection problems with "psql -h localhost postgres"  (Wayne Pierce <shalofin@gmail.com>)
List pgsql-novice
Wayne Pierce <shalofin@gmail.com> writes:
> I have PostgreSQL setup and everything is working fine when I use
> "psql -d <dbName>" on the command line or when I use mod_python to
> connect.  However I when I use "psql -h localhost <dbName> postgres" I
> get the following error:

> psql: could not connect to server: Connection refused
>         Is the server running on host "localhost" and accepting
>         TCP/IP connections on port 5432?

This is a kernel-level refusal: your connection request never got to the
postmaster at all, ergo the contents of pg_hba.conf etc are irrelevant.

Assuming you did start the postmaster with tcpip_socket enabled, the
only other possibility I know of is that the kernel is refusing the
connection because of packet filtering rules.  Check your firewall
setup and see what sort of restrictions are imposed on localhost
connections.  You at least want to allow traffic to/from port 5432,
and may want to loosen it up more while you are at it.

            regards, tom lane

pgsql-novice by date:

Previous
From: Wayne Pierce
Date:
Subject: Re: [despammed] Connection problems with "psql -h localhost postgres"
Next
From: Ennio-Sr
Date:
Subject: Re: Connection problems with "psql -h localhost postgres"