Our new customer portal is now live!
Guides

Use your database from your own computer

Open access to use your PostgreSQL database with TablePlus, DBeaver, pgAdmin or psql, or move your old database here.

7 min · Intermediate

Updated

In this guide

Before you start

You need permission to manage the service and a PostgreSQL database. Your database can only be reached from our servers and from the addresses you open access for yourself. Signing in always also needs the database's own user and password.

To look through tables or run SQL queries, you need neither your own tool nor an opening: on the Databases page, select Manage data on the database. Queries only read data unless you allow changes.

When you allow changes, you can also run a whole SQL script of up to 2 MB, such as a file an AI made for you: paste it or select Open a file. The script runs as one, so either every statement succeeds or nothing is saved.

Open access

  1. In the dashboard, open your service's Databases.
  2. Under Access from your own computer, select Open access.
  3. Check Your computer's address. It already holds the address you are using the dashboard from. If you connect from another computer or another network, enter its public IPv4 address.
  4. Choose how long access stays open: 1, 8 or 24 hours. Select Open access.
  5. Access works once it says Open until …. You also get an email about it.

Access closes by itself after the time you chose, and you can close it at any time with Close. Up to three can be open at a time.

Connect to the database

You need these details from the database's card: Host, Port, User, Database and Password. Select Show password to see the password, along with the Connection URL that holds all the details together.

SettingWhere from
HostHost
PortPort
UserUser
DatabaseDatabase
PasswordPassword
SSLRequired

Enter the host and the port in separate fields, without the port at the end of the host. Otherwise the tool can't find the server.

TablePlus, DBeaver or pgAdmin: create a new PostgreSQL connection, enter the details and set the SSL mode to require. For the best-protected connection, select Download the certificate on the databases page, add the file to the tool's SSL settings as the CA (root) certificate, and set the mode to verify-full.

pgAdmin: enter the database's name under Maintenance database. If connecting crashes on Windows with access violation writing 0x0000000000000000, the fault is in pgAdmin itself (for example version 9.18). On the Parameters tab, add GSS encmode and set it to disable. The connection is still encrypted with SSL.

psql: put the connection URL in quotes and change its end to check the server's certificate:

psql "postgresql://USER:PASSWORD@HOST:PORT/DATABASE?sslmode=verify-full&sslrootcert=nordichost-database-ca.pem"

Prisma Studio: set DATABASE_URL on your computer to the database's connection URL and run npx prisma studio.

Move a database as an SQL file

A database you built on your own computer moves here as one SQL file. An AI can make the file for you, or you make it yourself with pg_dump. Put your computer's database connection URL inside the quotes:

pg_dump --inserts --no-owner --no-privileges --file=database.sql "postgresql://..."

If your site creates its tables itself with migrations, add --data-only so the file has just the data.

  1. On the Databases page, select Manage data on the database.
  2. Turn on Allow changes.
  3. Paste the file or select Open a file, then select Run.

Either the whole file is saved or nothing is. A file can be up to 2 MB: split a bigger one and run the parts in order, tables first, or move the database the way below. Once your site is connected to the database, it uses the same tables and data.

Move your old database here

Use PostgreSQL's tools at the same version as your old database or newer, preferably 18.

  1. Back up your old database on your own computer. Put your old database's connection URL inside the quotes:
pg_dump --format=custom --no-owner --no-privileges --file=old.dump "postgresql://..."
  1. Open access from your computer as described at the start of this guide.
  2. Restore the backup into your database. Put your database's connection URL inside the quotes:
pg_restore --no-owner --no-privileges --dbname="postgresql://..." old.dump

--no-owner and --no-privileges leave out the old server's users and permissions, so everything belongs to your database's own user. Without them, the restore reports users that don't exist. The imported data counts toward your package's disk space.

When you're done

Close access with Close when you no longer need it. If you get an email about access you didn't open yourself, close it right away and change the database's password with Change password. Connected websites get the new password automatically.

Sources and further reading