Remote access to PostgreSQL with pgAdmin

June 20, 2017 1.3k views
PostgreSQL Ubuntu 16.04

I can't access remotely to a PostgreSQL, with pgAdmin database installed on an Ubuntu 16.04 droplet, with the Wordpress one install.

I would like to import a dump file, with the database settings from my local computer.

In the postgresql.conf file I have set:

listen_addresses = '*'

Running SHOW listen_addresses; I get localhost (1 row)

and in the pg_hba.conf one:

host all all 0.0.0.0/0 md5

But each time, that I try to connect from pgAdmin at my local computer I get this message:
could not connect to server: Connection timed out (0x0000274C/10060) Is the server running on host "139.59.151.107" and accepting TCP/IP connections on port 5432?

Any help would be much appreciated.
Thanks in advance,
Aleix Alcover

1 comment
2 Answers
jtittle MOD June 20, 2017
Accepted Answer

@aleixalcover

When doing a port scan on 139.59.151.107, only ports 22 and 80 seem to be open, so if you need to connect remotely, you'd need to open port 5432 in the firewall to be able to connect.

Since you're on Ubuntu, you can do this with ufw using:

ufw allow 5432/tcp

Let me know if that helps :-).

Have another answer? Share your knowledge.