Home sql psql: error: could not connect to server: could not connect to server:...

psql: error: could not connect to server: could not connect to server: No such file or directory

Author

Date

Category

I put it like this:

sudo apt install postgresql postgresql-contrib

How to fix it?


Answer 1, authority 100%

First, what does the command do?

sudo service postgresql status

Remove everything

sudo apt --purge remove postgresql-12 postgresql-client-12 postgresql-client-common postgresql-common

Then

sudo rm -rf / var / lib / postgresql /
sudo rm -rf / var / log / postgresql /
sudo rm -rf / etc / postgresql /
sudo userdel -r postgres
sudo groupdel postgres
sudo apt autoremove -y

Then install

sudo apt-get install postgresql postgresql-contrib

Check

pg_isready

Should be / var / run / postgresql: 5432

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions