How to connect to Postgres managed database accepting TCP/IP connections on port 5432?

Posted June 8, 2020 7.5k views
DigitalOcean Managed PostgreSQL Database

I’ve have been trying setup a Scalelite load balancer. The load balancer connects to an external Postgres database. I have setup the managed database, made incoming traffic open to all. The server and the managed database are in the same VPC, N1. No matter what I do I get the error below when I run:

connection timed out is the server running running on host "" and accepting    TCP/IP connections on port 5432?

Help will be really appreciated.

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 @elvisron,

The Managed Postgresql databases run on non-standard ports, you should not use the 5432 port but instead use the port which is specified in your Managed database settings.

I believe that the port which you should use is 25060.

Hope that this helps!

  • Hi bobbyiliev,

    Thanks for the feedback.

    The postgres connection does not require any port. It looks like this"

    DATABASE_URL: postgresql://username:password@connection_url

    Thank you.



    • Hi there @elvisron,

      Have you tried appending the port to the database hostname:

      DATABASE_URL: postgresql://username:password@connection_url:port_here

      Also if you have a firewall on your Droplet, make sure that the Managed Database port is allowed for outgoing TCP connections.

      Let me know how it goes!

      • Hi Bobby,

        I just tried adding the port and running again, but it doesn’t work. It does not recognize it as a correct path.

        I have no firewall running. Thank you