pf@pfortin.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