I have been working on this project all day and accidentally closed VSCode before making a database dump I’m worried that I might have lost my database tables/columns/etc. But it’s not the end of the world; I could remake it if I had to.
The weird part is that now I can’t reconnect to PSQL when I re-open VSCode. I’ve followed the steps in the project exactly as I did earlier today (go to the rdb-alpha folder and open the project by running “code .” from the command line, doing “rebuild and reopen in container,” starting CodeRoad, etc.), nothing different… but now, when I enter psql --username=freecodecamp --dbname=postgres to log into the interactive terminal, I get the following error message:
(Error message: 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”?)
Does anyone know how to solve this? Any advice would be gratefully accepted.
I’m on Linux Mint, and I had the exact same issue with the previous section of the course (the student database) on my MacBook.
You should never run rebuild if you want to keep your code. Unfortunately this action has cleared anything you may have created prior. (Use “reopen…” instead next time)
Looking at your screenshot, the environment looks broken.
You will have to reset the environment using the instructions here:
Unfortunately, it seems I spoke too soon. I was able to re-access my project following the linked instructions the other day, and after that session I successfully made a database dump before quitting, so I was expecting there would be no further problems.
However, today I tried to open up the project again by following the instructions linked in the answer marked as “Solution” (just as I had done with no problems the previous day), and now it’s not working again I’m getting the same error message I had previously, whether I try to log into psql or rebuild the database from my dump file:
Oh fantastic, this solved my problem! I would never have guessed that I had to reset my code. I did copy all the content of my insert_data.sh and queries.sh to external files first, which turned out to be wise because they did get deleted when I did this. But I can now access the database again with no problem. Thanks so much
Yes, the content of insert_data.sh and queries.sh got reset to the default starter content when I pressed “reset”. I’m not sure why, but at least I had saved them as external files on my desktop so I didn’t have to do all that again from scratch!
when I click reset I get the exact code that is applicable to the step I’m currently at in coderoad.
Does your step go back to level 1 again too? (or is this one of the projects. If it is a project, then yeah it would make sense it gets erased)