1

I am new to psql. In terminal. I entered the following command

psql -U postgres

I am facing the following error:

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"?

Someone please help me in this regard.

m.s.
  • 16,063
  • 7
  • 53
  • 88
Monisha
  • 89
  • 1
  • 6

1 Answers1

0

Please, post here related messages from: /postgres/server.log and psql --version.

If inside server.log something like this, read next.

FATAL: pre-existing shared memory block (key 5432001, ID 65538) is still in use HINT: If you're sure there are no old server processes still running, remove the shared memory block or just delete the file "postmaster.pid".

If you haven't a critical data in your postrgres, you could immediately try this fix:

  1. /etc/init.d/postgresql stop (if some processes running, try a peaceful shutdown)
  2. rm /usr/local/var/postgres/postmaster.pid (use the HINT, delete it)
  3. /etc/init.d/postgresql start (check it).
Les
  • 242
  • 1
  • 4
  • 13