Use your managed PostgreSQL database
Connect to PostgreSQL (psql, DBeaver, pgAdmin), enable SSL, manage users and automatic backups.
Use your managed PostgreSQL database
Your PostgreSQL instance is delivered ready to run. Credentials (host, port, user, password, database) are available in the panel’s Database / Credentials tab.
1. Connect
Command line (psql)
psql "host=<host> port=5432 dbname=<database> user=<user> sslmode=require"
Enter the password when prompted. sslmode=require forces TLS encryption (recommended).
From a GUI client (DBeaver, pgAdmin, TablePlus)
- Host: the address shown in the panel
- Port:
5432 - Database: your database
- Username / Password: from the panel
- SSL mode:
require(orverify-full)
2. Allow your IP
Remote access is filtered by default. Add your public IP under Database → Allowed IPs (or the service firewall tab). Otherwise the connection is refused.
3. Common operations
-- Create a read-only user
CREATE ROLE reader WITH LOGIN PASSWORD 'password';
GRANT CONNECT ON DATABASE <database> TO reader;
GRANT USAGE ON SCHEMA public TO reader;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO reader;
-- List active connections
SELECT * FROM pg_stat_activity;
4. Backups
Automatic daily backups are managed by onesubnet. For a manual export:
pg_dump "host=<host> port=5432 dbname=<database> user=<user> sslmode=require" -F c -f backup.dump
Restore: pg_restore -d "<conn_string>" backup.dump.
References
- PostgreSQL docs: https://www.postgresql.org/docs/
- pg_dump / pg_restore: https://www.postgresql.org/docs/current/backup-dump.html