Question

Timeout when connecting PgAdmin4 to Droplet postgres

Posted January 6, 2021 530 views
PostgreSQL

Hi guys,

I’m tearing my hair out!

I’ve done a tonne of research on connecting to this postgres instance, which is housed on a droplet (even just a basic connection).

So far I’ve:
-Changed the postgres port on the Droplet to 5433 (I already have a local postgres server so wanted to avoid clashes?)
-updated the pg_hba.conf file with

host all all (My public IP)/32 md5

  • then I’ve changed the postgresql.conf file:

listen_addresses = '*'

  • changed the postgres password to 1234 for my ‘postgres’ user (otherwise it would have no p/w)

  • restarted postgresql on the droplet.

Now I’m trying to set up a server on PgAdmin4 and using the Droplet IP as the Host Name, port 5433, username postgres and password 1234. No role or service.

Result is: 'Unable to connect to server: timeout expired’

I’ve tried changing pg_hba to 'trust’ instead, and to allowing all IPs (0.0.0.0/0), but I’m just not getting anything back from the droplet at all.

Any ideas?

1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there @simondavidmusic01,

What I could suggest is to run the following command to check if your PostgreSQL service is listening on 0.0.0.0:

netstat -plant

Another thing that I could suggest is to use an SSH tunnel with your SQL client rather than allowing direct access to the database for the whole world.

Regards,
Bobby