Problem with Relational DB Build a Bike Rental Shop

Hello, I keep running into an issue on this course where after a while of doing steps, the terminal no longer prints out the response to a command that I had typed in previously. E.g. I type in \d, and it is supposed to print out a list of the current table data in my database, but instad the terminal just accepts my command and nothing else prints. Then, after I tried to open another psql connection in a split terminal, the terminal gives me this error message.

camper: /project$ psql
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"?

After that, I can no longer do anything in that terminal. VSCode gives me a prompt that the window needs to be reloaded, and after doing so, my terminal resets back to bash. I still cannot connect to psql. I am stuck here and I have lost progress before by rebuilding the shell to try to get rid of this, but what can I do now?

Thanks for any help.

The psql terminal doesn’t respond if it is waiting for a command because it thinks you are not done typing. This happens if you forget to type the semicolon character.

At this point though, have you tried to close the current terminal, then click the reset button, then open another terminal after that (in this specific order)?

What color is your prompt in the terminal after this? If green, you have to restart the tutorial from scratch. If blue, then we can continue working with this tutorial.

I realised that pressing Control+D to quit the PSQL terminal and then reconnecting to it works. I’m not sure how this error comes by but this is the solution that works for me.

Thanks for your help and reply.

1 Like