Issues connecting to server, relational database course

After following the instructions for “Running the Relational Database Curriculum in your Browser”, I started the web-based relational database course, and completed 35% of the
Course and am encountering errors connecting to the server / database.

After reading multiple related issue logs in search of solutions, I have attempted the following remedies:

  • disabled cookies for freecodecamp
  • cleared browser cache
  • multiple page refreshes & browser restarts
  • deleted project container and tried to start over
  • tried using multiple browsers: chrome, safari, firefox.

The course appears to be launching but I cannot connect to the virtual machine. When attempting to log in using:

psql --username=freecodecamp --dbname=second_database

I see the following error message:

codeally@7fcdbd5a1cb6:~/project$ psql --username=freecodecamp --dbname=second_database
psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?

I would greatly appreciate any help with this issue,
Thanks!

1 Like

I think you refer to “Learn Relational Databases by Building a Mario Database” from “Relational Database”.
Are you sure that " second_database " has been created?
Try the " \l " command to see if it was created.

Yes, that’s the course, but not quite the issue.

After signing in with Github, the CodeRoad course window loads, I then open a terminal window to login to interact with the database via the terminal application, but…

I am unable to connect to the Psql terminal application in the terminal, much less enter commands such as “\l”. When I try to log in to the terminal Psql application I get the error:

“”"
psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
“”"

Note: the terminal application worked successfully when I started the course two days ago.

Here is a screen shot of error message if that might help.

Thanks!

You are only at the second step ( 20.1 ).
Have you passed the first step ( 10.1 )?


You said you completed 35% of the course and stopped when you created the second database.
According to the screen shot you posted, it seems that you haven’t passed 1% yet, or maybe you passed up to 35%, but then you deleted the project CodeAlly project.
How did you get back to step 2 (1%)? Does your current course appear in CodeAlly?

Please do not get me wrong. I don’t hold anything against you. I just want to help you to continue your project, to learn as much as possible, to follow a career that you aspire to.

My solution was:

codeally@67b7094c69f4:~/project$ ALTER TABLE second_table DROP COLUMN first_column;
bash: ALTER: command not found
codeally@67b7094c69f4:~/project$ psql --username=freecodecamp --dbname=second_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”?
codeally@67b7094c69f4:~/project$ echo hello PostgreSQL
hello PostgreSQL
codeally@67b7094c69f4:~/project$ psql --username=freecodecamp --dbname=second_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”?
codeally@67b7094c69f4:~/project$ pg_isready
/var/run/postgresql:5432 - no response
codeally@67b7094c69f4:~/project$ sudo service postgresql start

  • Starting PostgreSQL 12 database server [ OK ]
    codeally@67b7094c69f4:~/project$ psql --username=freecodecamp --dbname=second_database
    Border style is 2.
    Title is " ".
    Pager usage is off.
    psql (12.16 (Ubuntu 12.16-0ubuntu0.20.04.1))
    Type “help” for help.

second_database=>

1 Like

Thanks, the sudo service postgresql start made it work :disguised_face:

1 Like