Unable to connect to postgres

It might be related to one of the outages, freeCodeCamp and CodeAlly both had some issues recently - as well as updates.

Enter these commands in the terminal:

  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

They’re the commands that run when you start that project to set things up. Try to login again after that. Let me know if it works.

7 Likes