Troubleshoot - SQL (read only if you are stuck)

Here is a typical error that students ran into during the SQL part of the server setup. If you encounter this, no worries: there is a solution! Here:

ISSUE: SQL Workbench / pgadmin4 can't connect

If you see one of these error messages when you try to connect to your data server in SQL Workbench (or in pgadmin4)...

...well, first of all: no worries! We will fix it soon!

These errors mean that you:

  • either forgot to run these lines from the tutorial:
    • echo "listen_addresses = '*'" >> /etc/postgresql/*/main/postgresql.conf
    • echo 'host all all 0.0.0.0/0 md5' >> /etc/postgresql/*/main/pg_hba.conf
  • or, you ran them but made a typo.

STEP #1

Let's figure out what's wrong! First, go back to root user. Type this:

sudo -i -u root

And now type:

history

This prints all the commands you typed in so far as the root user… You'll see something like this in the first few lines of your command history:

Again, you are looking for these two commands:

  • echo "listen_addresses = '*'" >> /etc/postgresql/*/main/postgresql.conf
  • echo 'host all all 0.0.0.0/0 md5' >> /etc/postgresql/*/main/pg_hba.conf

STEP #2

If either one is missing, just rerun it!

If both are missing, rerun both!

If you see them and you found that you made a typo in one (or both) of them, then... well, first of all, don't worry, this is one of the most typical mistakes; other participants made it too.

Secondly, unfortunately, with your current knowledge, it's really difficult to fix it yourself, so you can do two things:

1) Reach out to me (Tomi) via email and I will go ahead and fix the issue for you.

If you prefer this one, please create a new user for me on your server (make sure that you don't store any confidential data there right now, though ;-)) by typing these two commands:

  • sudo adduser tomi
  • sudo usermod -aG sudo tomi

Once that's done, send me an email, containing the username and password you created for me on your server and your server's IP address. With that, I'll be able to login and fix the issue for you -- and then I'll send you a follow-up email.

2) The alternative is something that students usually don't like -- regardless, I encourage you to go with this one because from a learning perspective that's the most useful for you.

This is: destroy your current server and try to set up a new one from scratch. If you choose this option, put an extra emphasis on making sure that you avoid any typos and that you follow the tutorial very thoroughly.

Remember, a single mistyped character can cause an issue. But if you type in everything accurately, the server will work.


PS. If these weren't your issue, send me an email and I'll help you!