Re: Cannot connect although server is running - Mailing list pgsql-novice

From Tom Lane
Subject Re: Cannot connect although server is running
Date
Msg-id 28954.1238966962@sss.pgh.pa.us
Whole thread Raw
In response to Cannot connect although server is running  (Kai-Martin <kmk@familieknaak.de>)
List pgsql-novice
Kai-Martin <kmk@familieknaak.de> writes:
> Since about a month I can't connect to my local postgres server
> any more.

> $ psql
> psql: could not connect to server: No such file or directory
>     Is the server running locally and accepting
>     connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

> However, the server seems to be running fine:

> $ ps aux |grep postgresql
> postgres 11406  0.0  0.2  21812  3960 ?        S    06:24   0:00 /usr/lib/
> postgresql/8.1/bin/postmaster -D /var/lib/postgresql/8.1/main -c
> config_file=/etc/postgresql/8.1/main/postgresql.conf

Well, is there a file "/tmp/.s.PGSQL.5432"?  If not, does stopping
and restarting the PG server make it come back?

If that does fix it, then the most likely bet is that you have an
over-aggressive /tmp-cleaning script that removed the file despite
its being a live socket file.

If that doesn't fix it, my next bet is that you are using a build
of Postgres that puts the socket file someplace other than /tmp.
I believe the standard Debian packaging of PG does in fact put it
someplace else (somewhere under /var/run if memory serves ---
lsof on the postmaster process should tell you for sure).  If that's
the story, then you must be trying to use a copy of psql/libpq
that wasn't built by Debian and is configured to look in /tmp.
You could force the matter by specifying -h /var/run/wherever
to psql, but it's probably best to install a matching set of executables.

Or maybe you've found some creative new way to break it ;-)
but those are the most common explanations for this error message.

            regards, tom lane

pgsql-novice by date:

Previous
From: Kai-Martin
Date:
Subject: Cannot connect although server is running
Next
From: "Jana Vasseru"
Date:
Subject: Export