0

I can access the remote PostgreSQL server in the lab from both the terminal and using pgAdmin4 when connected to same private network.

From Terminal:

PC:~$ psql -h 193.13x.xx.xx -U myusername -W dbname
#then password after prompt

Using pgAmin4:

Host name/address: 193.13x.xx.xx
Port: 5432
Maintainance database: dbname
Username: myusername
Password: *******

However, when I switched to another network eduroam, I can only connect to the remote server via the terminal, not from pgAdmin4. So it is not very easy to work away from the lab.

Is there a workaround to enable connecting via pgAdmin4?

4
  • Do you get an error Message? Commented Jan 7, 2020 at 16:51
  • Yes, 'could not connect to server: Connection refused. Is the server running on host "193.13x.xx.xx" and accepting TCP/IP connections on port 5432?' Commented Jan 7, 2020 at 16:59
  • Did you check for a Firewall ( on your local machine) blocking outgoing connections for one application but not the other? Commented Jan 7, 2020 at 17:07
  • Yes, checked with localhost firewall settings. Commented Jan 7, 2020 at 17:29

1 Answer 1

2

I can only connect to the remote server via the terminal, not from pgAdmin4. So it is not very easy to work away from the lab. Is there a workaround to enable connecting via pgAdmin4?

Yes. The generic answer to that is: use an SSH tunnel. It's very usual when you cannot access directly a database from outside a certain network, which appears to be your case based on the error message in the comments.

If you need specific advice for pgAdmin4, consider searching for "pgadmin4 ssh tunnel", there are many tutorials available online.

Sign up to request clarification or add additional context in comments.

2 Comments

If that is the solution, then why can OP connect with psql? Both are using libpq.
@LaurenzAlbe: my interpretation of I can only connect to the remote server via the terminal is the OP does ssh and psql in the local session, not a remote psql.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.