I changed the port of Postgres to 2345 and I have the socket in:


If I run psql I get this error:

psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory

how to pass the socket path?

1 Answer 1


You need to use -p option

psql -p 2345
  • that works but is using TCP or the socket?
    – nbari
    Commented Feb 10, 2022 at 14:08
  • since you don't provide a host --host=.. psql uses its predefined socket directory by default. which is /tmp in rhel / centos etc
    – Sahap Asci
    Commented Feb 10, 2022 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.