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.
Your problem is addressed there.
I have looked at that and can’t get it to work at all. I’m on a Windows10 machine as well.
I’m having no luck with this at all, and I can’t keep restarting the project every time just because I close VS Code and Docker.
Maybe try the pg_dump utility
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:
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:
sudo pg_ctlcluster 10 main start
Yeah, but after I did that I got another error: psql: error: FATAL: Peer authentication failed for user “freecodecamp”
And I haven’t found a fix for that one yet, even after googling it for a couple hours.