pavan95 <pavan.postgresdba@gmail.com> writes:
> I'm facing an error in starting my postgresql database. The error is as
> shown below:
> bash-4.1$ psql
> psql: could not connect to server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket
> "/var/run/postgresql/.s.PGSQL.5432"?
Note the error message: it mentions the Unix socket location
"/var/run/postgresql/.s.PGSQL.5432". This means the psql (or
more precisely, libpq.so) that you're using thinks that PG
socket files live in /var/run/postgresql. That is *not* standard;
as shipped by the community, PG puts its socket files in "/tmp".
However, various distros think that is bad style and override
the build option to put the socket files elsewhere, most often
/var/run/postgresql.
In short, you are probably using a vendor-supplied libpq to
try to talk to a PG server that was built from unmodified
community code. You could confirm the latter by looking to see
if there's a /tmp/.s.PGSQL.5432 socket file.
You could use "psql -h /tmp" to override libpq's idea of the
socket location, or use "psql -h localhost" to forget about
socket files and connect via TCP, or change the server's
unix_socket_directories parameter to make it create a socket
(or additional socket) in /var/run/postgresql, or replace
either your libpq or your server with something that's got
the same built-in default location as the other end.
regards, tom lane