Remote connect to postgresql with pgadmin

Posted October 10, 2015 70.7k views

Hi! So i have a test database running on my droplet, but I just cannot remote connect to it. It PGAdmin I have host as my droplet IP, port as 5432, maintenance DB as postgres and username as postgres and password blank, and I get connection refused errors asking me if my server is listening for TCP/IP connections.

I’ve edited the config file to allow ip’s from “*”, and I thought that was all there was to it…
So, am I missing something? Do I need to make additional changes? Or do I need to VPN into digital ocean servers or something?

Any help is appreciated.
Thanks in Advance

1 comment
  • Hi, were you ever able to get this solved?
    I am having the same issue on a Django 1-click install on Ubuntu.
    I have the name, user, and password, also trying on port 5432, using the Pycharm IDE’s. I have been able to connect to remote MySQL and SQL-Servers elsewhere in the past using this IDE.

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
6 answers

Did you change pg_hba.conf?

sudo nano /etc/postgresql/9.3/main/pg_hba.conf

and allow connection by all users to all databases from any IP if the user has right MD5-encrypted password by adding the following line:

host all all md5

I have a step-by-step instruction in my blog (sorry for the shameless plug)


    Thanks for posting :) Firstly. I hadn’t even made changes to the pg_hba.conf, only the other one.

    SECONDLY, I hadn’t even done the first one correctly, as I accidentally left ‘listen_addresses’ COMMENTED OUT!

    Your blog is beautifully written, I’ve actually gone ahead and bookmarked it.

    Thanks a million :)

  • I have the same problem, but your blog link its broken! :(

  • do not forget to add


    to your postgresql.conf file

If you are using firewall don’t forget to allow port 5432
for ufw use :

ufw allow 5432/tcp

Links above appear to be dead. This worked for me:
Connecting to PostgreSQL on Linux

@kirilscherbach you’ve provided a much better instruction than the official page of Digital Ocean. The problem is that you haven’t enabled the right url slug etc “ How to configure your Postgresql database on Digital ocean” or “How to bla bla bla” and it would have saved me time searching for how to do exactly what you wrote.

You’ve done a fine job writing that article. Hope you change your url slug. ;)

I do the samething and works when i change password

sudo -u postgres psql

ALTER USER sammy PASSWORD ‘newpassword’;