L
L
Ler Den2019-05-28 15:14:11
PostgreSQL
Ler Den, 2019-05-28 15:14:11

How to fix "psql: Could not connect to server"?

At some point, the bd stopped responding.
Server - Ubuntu 16.04
DB - PostgreSQL 10
Gives error

"psql: failed to connect to server: No such file or directory. Is
it really running locally and accepting
connections via Unix socket "/var/run/postgresql/.s.PGSQL.5432"?"

the specified folder contains an empty folder "10-main.pg_stat_tmp".
I connect
psql -U postgres -p 5432 -h localhost
either like this
psql
or see the version like this
postgres -V
In the latter case I get
"Command 'postgres' not found"

What suggests that the database crashed, but there are folders with some files with postgres, for example, in /etc/postgresql
and the restart command seems to be successfully executed
sudo systemctl restart postgresql.service
So it didn’t crash? Or crashed? I would look to see if there are data files, but I can't find the location.
Is it treatable and what steps can be taken?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question