0
votes

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?

3
What does which psql show you?Milen A. Radev
@Milen, do you mean what is shown when I type the command psql? I already mentioned it above.xxx

3 Answers

4
votes

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"
1
votes

You could include the database user too:

psql -U postgres -p 5432 -h localhost

0
votes

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