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

Tell us what’s happening:

When trying to go back to where I left the course I get this error on the terminal:

camper: /project$ psql --username=freecodecamp --dbname=postgres
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?

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.4 Safari/605.1.15

Challenge Information:

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

Hey there, I had the same issue and just found a post with a solution this morning.

Enter these commands:

  1. sudo cp ./.freeCodeCamp/pg_hba.conf /etc/postgresql/12/main/pg_hba.conf
  2. sudo chown -R postgres:postgres /var/lib/postgresql/12/main
  3. sudo service postgresql restart
  4. echo “SELECT ‘CREATE USER freecodecamp WITH CREATEDB’ WHERE NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname=‘freecodecamp’)\gexec” | psql -U postgres -X

Might be slightly different since you are on a Mac.

Also make sure you are saving a dump of the database when you have the workspace open. The workspace should save the .sql dump file and you’ll be able to rebuild the database when you log back in. If you need any help just let me know.