Skip to content
Advertisement

psql: could not connect to server: No such file or directory “Centos7”

Not able to access psql database. Below is the error while accessing database:

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

I also tried to look for postmaster.pid but didn’t find it

Advertisement

Answer

Your server is down or at least not where your psql command thinks it is. You can search your system for postgres.conf which should tell you what port it’s on, and you can try starting the server manually. I would start by looking for the conf file. There may be logging inside /var/log or such you can inspect for further clues if it’s a case that the server is having problems and not that you don’t know the port/dbname.

Good luck

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement