Re: Error when starting postgres database!!

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pavan95 <pavan(dot)postgresdba(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Error when starting postgres database!!
Date: 2018-10-09 04:38:21
Message-ID: 3190.1539059901@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

pavan95 <pavan(dot)postgresdba(at)gmail(dot)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message pavan95 2018-10-09 04:46:42 Re: Error when starting postgres database!!
Previous Message Mark Kirkwood 2018-10-09 04:33:41 Re: Error when starting postgres database!!