Re: error: connection to server on socket...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pf(at)pfortin(dot)com
Cc: pgsql-general(at)lists(dot)postgresql(dot)org, Amn Ojee Uw <amnojeeuw(at)gmail(dot)com>
Subject: Re: error: connection to server on socket...
Date: 2023-08-01 13:10:57
Message-ID: 3069605.1690895457@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

pf(at)pfortin(dot)com writes:
> On Tue, 1 Aug 2023 06:22:46 -0400 Amn Ojee Uw wrote:
>> "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory*//*

> Like mine, your distro probably uses /tmp/.s.PGSQL.5432
> $ ll /tmp/.s.PGSQL.5432
> srwxrwxrwx 1 postgres postgres 0 Aug 1 06:33 /tmp/.s.PGSQL.5432=

Yeah. Look to see if there's a socket file there, and if so try

sudo -u postgres psql -h /tmp

In the longer term, this indicates that you have a psql that did
not come from the same packager as your server, because the server
thinks the default socket location is /tmp, but psql (or really
the libpq.so it's using) thinks the default location is
/var/run/postgresql. That's a build-time choice that some
packagers make because $standards. So the long-term fix is to
not have a hodge-podge of different Postgres installations on
the same machine.

BTW, you can ignore the "could not change directory" warning.
That's expected when starting "sudo -u postgres psql" in a
directory that the postgres user can't read.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2023-08-01 14:33:07 Re: PORT 5432 ERROR
Previous Message Matthias Apitz 2023-08-01 11:57:08 Re: error: connection to server on socket...