Learn Relational Databases by Building a Database of Video Game Characters - Build a Database of Video Game Characters

Tell us what’s happening:

i wanted to log in to continue but i keep on getting an error when logging into to postgres database even though my progress is not lost.

camper@4963e6ac68db:/workspace/project$ psql --username=freecodecamp --dbname=mario_database
psql: error: could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36

Challenge Information:

Learn Relational Databases by Building a Database of Video Game Characters - Build a Database of Video Game Characters

Try clicking the reset button to reset the connection.
After that you may need to open a new bash window.

still not working, same error message

unfortunately I can’t help further. When I get this error, the reset button works for me. (I may need to open a new bash terminal but that’s all I ever needed to get the setup for postgres back)

So just to be sure you know exactly how it works for me.
1- click Reset
2- open new bash terminal
3- the colors on the prompt should be blue now (not green)
4- run the psql statement from the new terminal

Do you think it has something to do with git or docker, because i resarted my computer but same error

i don’t think it is related to git as git is a tool used to keep track of changes made to files.
It may be related to docker, but I’m not sure what else to suggest here.

okay, thanks very much

maybe you can try looking for a .freeCodeCamp directory in your bash terminal
If you can find it, cd to it and run npm install
then after that try the reset again

Yeah, i still cant find where the error is from. i think i need a bit of rest to come back to this. thank you once again, you have been supportive

I tried looking thru old posts to see if there are any tips on this.

Maybe it is worth trying some of the suggestions like:
try running
sudo service postgresql start

if that doesn’t work, please post the output, maybe there’s a clue in it

this was the output

camper@5488560baac7:/workspace/project$ sudo service postgresql start

  • Starting PostgreSQL 12 database server [ OK ]
    camper@5488560baac7:/workspace/project$ psql --username=freecodecamp --dbname=mario_database
    psql: error: FATAL: Peer authentication failed for user “freecodecamp”
    camper@5488560baac7:/workspace/project$

this was after you ran Reset and opened a new bash terminal right?

yes, after i clicked on the reset button

please confirm again. You did open a new terminal after you clicked Reset?

that is exactly what i did

i read some more old posts and some thoughts on this include that you can try moving on to a different project.
If you move on to a different project without deleting your current container that may somehow help reset something.

oh okay.. i will try that

i found something else that you may want to try

(run them in order)
sudo chown -R postgres:postgres /var/lib/postgresql/12/main

sudo service postgresql stop && sudo service postgresql start && echo "SELECT 'CREATE USER freecodecamp WITH CREATEDB' WHERE NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname='freecodecamp')\gexec" | psql -U postgres -X

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.