RhOiYdS
By:
RhOiYdS

Remote connect to postgresql with pgadmin

October 10, 2015 20.9k views
PostgreSQL Node.js Ubuntu

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.

3 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 0.0.0.0/0 md5

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

  • I COULD KISS YOU!

    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!

    Hahah.
    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

    listen_addresses='*'
    

    to your postgresql.conf file

@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. ;)

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

Have another answer? Share your knowledge.