I'm able to start the service with pgenv and pg_ctl but cannot connect with psql. The following error shows:

$ psql -l
psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?

I checked the path of the mentioned socket but it does not exist as psql reports.

If I use pg_ctl status, the following is returned:

$ pg_ctl: server is running (PID: 2127388)

I checked the server.log file and it says that is listening on a different socket. Please see the following:

$ file /tmp/.s.PGSQL.5432
/tmp/.s.PGSQL.5432: socket

How can I troubleshoot this?

1 Answer 1


I found the solution!

All there was to do was to create the directory /run/postgresql and assign the right permissions to that same directory. Ownership must belong to the system user account (e.g. postgres) that is executing postgresql.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .