Connect to your database

Copy the host, user and password from the Connect tab, always use TLS, and connect with psql, your app or a GUI tool.

Updated November 17, 2026 · 2 min read · Managed Postgres: Getting started

Everything you need is on your database's Connect tab (Services → your database).

Connection details

  • Host: shown on the tab (it ends in .db.ondigitalocean.com).
  • Port: 25060
  • User: doadmin
  • Database: defaultdb
  • Password: click Show. The full connection string appears too.

Your computer or server must be allowed to connect: see Trusted sources.

Always use TLS

Connections must be encrypted. Use sslmode=require. For full certificate checking, download the CA certificate on the Connect tab and use sslmode=verify-full with it.

Examples

The Connect tab has these filled in with your host. Keep the password in an environment variable such as DB_PASSWORD.

psql

PGPASSWORD="$DB_PASSWORD" psql "host=YOUR-HOST port=25060 user=doadmin dbname=defaultdb sslmode=require"

Node.js (pg)

import fs from 'node:fs';
import pg from 'pg';

const client = new pg.Client({ host: 'YOUR-HOST', port: 25060, user: 'doadmin', database: 'defaultdb', password: process.env.DB_PASSWORD, ssl: { rejectUnauthorized: true, ca: fs.readFileSync('ca-certificate.crt').toString() }, }); await client.connect();

Python (psycopg)

import os, psycopg

conn = psycopg.connect(host="YOUR-HOST", port=25060, user="doadmin", dbname="defaultdb", password=os.environ["DB_PASSWORD"], sslmode="verify-full", sslrootcert="ca-certificate.crt")

PHP (PDO)

$pdo = new PDO(
    'pgsql:host=YOUR-HOST;port=25060;dbname=defaultdb;sslmode=verify-full;sslrootcert=ca-certificate.crt',
    'doadmin', getenv('DB_PASSWORD')
);

GUI tools

DBeaver, pgAdmin, TablePlus and DataGrip work with the same host, port, user, password and database. Set SSL mode to require (or verify-full with the CA certificate).

More databases and users

Create them with SQL, for example CREATE DATABASE shop; and CREATE ROLE app LOGIN PASSWORD '...';. Give your app its own user instead of doadmin where you can. Supported extensions such as PostGIS, pgvector, pg_stat_statements and uuid-ossp are added with CREATE EXTENSION.

Was this article helpful?

Still need help?

Our team answers every request, usually within a few hours.

Contact Support

We use cookies to enhance your experience, provide live chat support, and analyze site traffic. By clicking "Accept", you consent to our use of cookies.

Cookie Policy
Accept