0

Under the postgres user, I tried the psql command and I'm getting this 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"

But when I run /usr/local/pgsql/bin/psql, it is working.

Is there anything wrong with my configuration?

2
  • What does which psql show you? Commented Sep 20, 2012 at 6:21
  • @Milen, do you mean what is shown when I type the command psql? I already mentioned it above. Commented Sep 20, 2012 at 11:04

3 Answers 3

4

the above issue seems related to PostgreSQL default port no,

Change the port no in postgresql.conf file and restart the DB server. if u have changed the port while installing.

(OR)

instead of psql type full command like

 "psql -p 5432 -h localhost"
Sign up to request clarification or add additional context in comments.

Comments

1

You could include the database user too:

psql -U postgres -p 5432 -h localhost

Comments

0

Did you reinstall the postgresql-9.6.3 ?

You need to uninstall postgresql completely

sudo apt-get --purge autoremove postgresql*

sudo apt install postgresql-9.6

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.