App overview screenshotSQL and Database Guides
PostgresMySQLSQLite
Try our free SQL Client
Tools
Connecting to Postgres
Connecting to Drivers
Installing Postgres
Setting up Postgres
Postgres   >   
Connecting to Postgres   >   
Postgres on Digital Ocean

Connecting Postgres and Digital Ocean

How to connect to Postgres on digital ocean

This guide will show you how to connect Postgres to a Digital Ocean droplet and test this connection using Arctype. An example of doing this in one click is below.

Successful connection

Installing Postgres

If you don’t already have Postgres installed on your Digital Ocean droplet, you can do so using the command below:


sudo apt install postgresql postgresql-contrib

You can also spin up a managed database cluster on the Databases tab in the Digital Ocean web console.

Connecting to the PostgreSQL database from the Command Line

To connect using the flags format with Postgres using the doadmin user, paste the entire command from the control panel into your terminal:

PGPASSWORD=your_password psql -U doadmin -h your_cluster.db.ondigitalocean.com -p 25060 -d defaultdb --set=sslmode=require

When you connect successfully, your terminal changes to the psql prompt, which displays the name of the database you’re connected to.

Connecting using Arctype

Test your connection using Arctype.

Successful connection

Get help on databases and SQL. Join our Discord community.