I’m doing the student database project, and if I close VS Code and Docker, I lose my progress. I can get the CodeRoad started again but I can’t connect to sql and I get this error: psql: error: 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”?
Is there a way to fix this without restarting every time? I’m trying to learn this so I can start working for someone that needs me to learn it.
I’ll take a look, I just don’t understand why it won’t connect again after restarting docker and vs code. I have to reset my progress and input the url again to connect with no issues.
Did you try doing this?
"
List all the Postgres clusters running on your device:
pg_lsclusters
this gave me this output in red colour, showing that they were all down and the status also showed down:
Ver Cluster Port Status Owner Data directory Log file
10 main 5432 down postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log
11 main 5433 down postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log
12 main 5434 down postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
Restart the pg_ctlcluster for one of the server clusters. For me I restarted PG 10: