Learn SQL by Building a Student Database: Part 1 - Build a Student Database: Part 1

Tell us what’s happening:

I’m around 25% of the way, on the step "Next, you can start adding some info. Since the students table needs a major_id, you can add a major first. View the details of the majors table to see what info it expects".

I know the course is meant to be done in one sitting, but life is not like that and I had to attend to other things while doing the course, and I was disconnected from GitPod. Once I tried to reconnect, my virtual machine opens in bash, but I can’t seem to connect to psql:

camper: /project$ psql --username=freecodecamp --dbname=students psql: error: connection to server at "127.0.0.1", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections?

I’ve tried Googling the error, but can’t seem to figure out a way to get through it. My VM on GitPod seems to be working fine, but I don’t know enough about it to be sure. Any tips on what else I can do here?

I’ve pinned the project on GitPod so I don’t lose it, and accidentally created a new one on FCC’s project page. Will FCC still understand the old project as finished even if I created a new one?

I’m trying to avoid having to re-do what I’ve done so far, but if that’s the only solution … so be it. Any ideas to try to save this project before doing that are welcome, thou.

EDIT - Status update. From the GitPod launch page, I’ve tried launching the project on the browser, closed it, and re-opened in VS Code. It’s working now. I’ll leave it open in case anyone has any idea what happened, but at least I was able to move forward and hopefully this message will be helpful to someone else. Cheers!

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0

Challenge Information:

Learn SQL by Building a Student Database: Part 1 - Build a Student Database: Part 1

Gitpod shuts down workspaces that are inactive for 30minutes. So the PostgreSQL service might stop when the workspace was suspended when GitPod container was idle for an extended period.
When you restart Gitpod, yo connect to the container (via SSH, for example), but you may need to start PostgreSQL server again. You can do so by typing following in bash:

sudo service postgresql restart

When you reconnected Gitpod but still received the error for postgress sql, it might be due to PostgreSQL server not running or can’t accept connections. In GitPod, the PostgreSQL service might have been temporarily unavailable when you first tried to reconnect.

Hope this helps!

Additionally you can check the postgres running by following command

ps aux | grep postgres

Just got this same kind of error, its fixed when closing CodeRoad and run it again at Command Palette, it wouldn’t reset your course progress.