Thread: [GENERAL] psql only works with -h (even localhost)

[GENERAL] psql only works with -h (even localhost)

From
ProPAAS DBA
Date:
Hi all;


we have a client server where 'psql -h localhost' is the only way psql
will connect when ssh'd onto the db server. Would like to be able to
just run psql but not sure what the issue/fix is. Anyone have any
insight hot to fix this?


Thanks in advance





Re: [GENERAL] psql only works with -h (even localhost)

From
Adrian Klaver
Date:
On 01/25/2017 08:02 AM, ProPAAS DBA wrote:
> Hi all;
>
>
> we have a client server where 'psql -h localhost' is the only way psql
> will connect when ssh'd onto the db server. Would like to be able to
> just run psql but not sure what the issue/fix is. Anyone have any
> insight hot to fix this?


What is the error you get if you use something other then -h localhost?

What is in pg_hba.conf?

>
>
> Thanks in advance
>
>
>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: [GENERAL] psql only works with -h (even localhost)

From
Steve Crawford
Date:
Adrian asks the correct questions. Lacking the answers to those I'm going to venture a guess that a Unix-domain socket exists but access via Unix-domain sockets is somehow blocked, probably by pg_hba.conf.

From the psql man page: "...Not all of these options are required; there are useful defaults. If you omit the host name, psql will connect via a Unix-domain socket to a server on the local host, or via TCP/IP to localhost on machines that don't have Unix-domain sockets...."

Cheers,
Steve




On Wed, Jan 25, 2017 at 8:07 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 01/25/2017 08:02 AM, ProPAAS DBA wrote:
Hi all;


we have a client server where 'psql -h localhost' is the only way psql
will connect when ssh'd onto the db server. Would like to be able to
just run psql but not sure what the issue/fix is. Anyone have any
insight hot to fix this?


What is the error you get if you use something other then -h localhost?

What is in pg_hba.conf?



Thanks in advance







--
Adrian Klaver
adrian.klaver@aklaver.com



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] psql only works with -h (even localhost)

From
Melvin Davidson
Date:

On Wed, Jan 25, 2017 at 11:07 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 01/25/2017 08:02 AM, ProPAAS DBA wrote:
Hi all;


we have a client server where 'psql -h localhost' is the only way psql
will connect when ssh'd onto the db server. Would like to be able to
just run psql but not sure what the issue/fix is. Anyone have any
insight hot to fix this?


What is the error you get if you use something other then -h localhost?

What is in pg_hba.conf?



Thanks in advance







--
Adrian Klaver
adrian.klaver@aklaver.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

What is O/S -h localhost points to?
What is the version of PostgreSQL?




--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Re: [GENERAL] psql only works with -h (even localhost)

From
Tom Lane
Date:
Steve Crawford <scrawford@pinpointresearch.com> writes:
> Adrian asks the correct questions. Lacking the answers to those I'm going
> to venture a guess that a Unix-domain socket exists but access via
> Unix-domain sockets is somehow blocked, probably by pg_hba.conf.

Actually, the more common case I've seen is that the server put the
socket file in directory X but psql (or more specifically libpq)
is looking in directory Y.  Try "show unix_socket_directories"
(or on older server versions "show unix_socket_directory") in a
successful connection, and compare to the path that psql shows when
bleating that it can't connect.

Usually this isn't operator error per se, but inconsistent defaults
between builds obtained from different sources.

            regards, tom lane


Re: [GENERAL] psql only works with -h (even localhost)

From
ProPAAS DBA
Date:

On 01/25/2017 09:35 AM, Tom Lane wrote:
> Steve Crawford <scrawford@pinpointresearch.com> writes:
>> Adrian asks the correct questions. Lacking the answers to those I'm going
>> to venture a guess that a Unix-domain socket exists but access via
>> Unix-domain sockets is somehow blocked, probably by pg_hba.conf.
> Actually, the more common case I've seen is that the server put the
> socket file in directory X but psql (or more specifically libpq)
> is looking in directory Y.  Try "show unix_socket_directories"
> (or on older server versions "show unix_socket_directory") in a
> successful connection, and compare to the path that psql shows when
> bleating that it can't connect.
>
> Usually this isn't operator error per se, but inconsistent defaults
> between builds obtained from different sources.
>
>             regards, tom lane


Thanks Tom;

This was the issue...