0

I am using postgresql 13. When I type psql I get this:

psql: error: could not connect to server: Ficheiro ou pasta inexistente
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

I installed it using

sudo apt update
sudo apt install postgresql postgresql-contrib

systemctl status gives this

postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
     Active: active (exited) since Thu 2021-02-04 15:04:55 -03; 6min ago
    Process: 35313 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
   Main PID: 35313 (code=exited, status=0/SUCCESS)

fev 04 15:04:55 diego-I42IL1 systemd[1]: Starting PostgreSQL RDBMS...
fev 04 15:04:55 diego-I42IL1 systemd[1]: Finished PostgreSQL RDBMS.

It seems ok.

Diego Alves
  • 2,462
  • 3
  • 32
  • 65

1 Answers1

0

Before I used the installation commands stated in the question I am "almost" certain that I had used other commands to install postgres. The problem is that I had several versions installed.

I used this command pg_lsclusters

It will show the clusters and the ports the are using

12  main    5432 down,binaries_missing <unknown> /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
13  main    5433 online                postgres  /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log

I wasn't connecting to postgresql because I supposedly had purged version 12. But the task of removing postgresql is not as easy as installing it. The system was seeing Potgres as installed(even though th libs were missing) and was using the default port.

To use the right port use this command "psql --port 533'3'"

Diego Alves
  • 2,462
  • 3
  • 32
  • 65