Skip site navigation (1) Skip section navigation (2)

Re: Connection problems with "psql -h localhost <dbName> postgres"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wayne Pierce <shalofin(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Connection problems with "psql -h localhost <dbName> postgres"
Date: 2005-05-02 15:17:24
Message-ID: 18572.1115047044@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Wayne Pierce <shalofin(at)gmail(dot)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

In response to

pgsql-novice by date

Next:From: Ennio-SrDate: 2005-05-02 16:09:28
Subject: Re: Connection problems with "psql -h localhost <dbName> postgres"
Previous:From: Wayne PierceDate: 2005-05-02 14:03:33
Subject: Re: [despammed] Connection problems with "psql -h localhost <dbName> postgres"

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group