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

From: Wayne Pierce <shalofin(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Connection problems with "psql -h localhost <dbName> postgres"
Date: 2005-05-02 13:03:50
Message-ID: 4617fd6d0505020603749c0188@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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?

I have the following lines in my pg_ident.conf and pg_hba.conf files:

-- pg_ident.conf --
# MAPNAME IDENT-USERNAME PG-USERNAME
localhost all all
host all all

-- pg_hba.conf --
# TYPE DATABASE USER IP-ADDRESS/CIDR METHOD
# IPv4-style local connections:
host all all 0.0.0.0 0.0.0.0 trust
host all all 127.0.0.1/32 trust
#host logs postgres 127.0.0.1/32 trust
#hostnossl all all 10.1.100.143/32 trust

# Using sockets credentials for improved security. Not available everywhere,
# but works on Linux, *BSD (and probably some others)
local all all trust

I have tried various combinations, but nothing works. I have tried
setting tcpip_socket in $PGDATA/postgresql.conf to 'true' and 'false'
with a restart each time.

The reason I need this to work is Ruby on Rails, for some reason rails
connects with the command line option above. I have no idea why it
will work on way but not another. I have tried to turn off IDENT
authentication completely (I am the only one with an account on this
system and the only one interacting directly with the database).

Does anyone know how to fix this? I didn't find too much in the
mailing lists on using the -h option.

Thanks for any suggestions or help,

Wayne

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Andreas Kretschmer 2005-05-02 13:38:53 Re: [despammed] Connection problems with "psql -h localhost <dbName> postgres"
Previous Message Ennio-Sr 2005-05-02 00:38:39 Re: psql: Is it possible to run a query from a *sql file?