Psql: error: could not connect to server: Connection refused

Hello,

I am currently doing the Build a Database of Video Game Characters course, located inside the Relational Databases Certification course.

The course is asking me to log in to psql by running the psql --username=freecodecamp --dbname=postgres command, but when I run it, the

following error appears:

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”?

I’m not sure of what is causing this error. Could you please help me out?

try to click the Reset button and let it finish resetting your environment which should restart psql.

Be patient and wait for the script to finish completely. After that:

  • Close your terminal
  • Open a new terminal and try again

If still stuck, please take a screenshot of your vscode working area and terminal too and show it here

1 Like

Clicking the reset button worked. Thank you!

1 Like