How to connect to a managed MySQL, PostgreSQL or MariaDB database

Skip to main content
Print

How to connect to a managed MySQL, PostgreSQL or MariaDB database

Open your database in the PD Hosting client area, click View connection details, and copy the server, port, database, username and password, or the ready-made connection string. Connect with TLS using the certificate bundle shown there, and add your servers’ IP addresses to the allowlist if your plan has one.

Applies to: managed databases (MySQL, PostgreSQL and MariaDB).

Step 1: get your connection details

  1. Open your database service in your client area.
  2. On the overview, click View connection details.
  3. Copy the Host, Port, Database, Username and Password (click Show), or copy the Connection string.

Your database is called main. The username is admin on MySQL and MariaDB and pdmaster on PostgreSQL. Use the port shown (MySQL normally 3306, PostgreSQL 5432).

Step 2: connect securely

The Secure connection (TLS) section links to the certificate bundle, global-bundle.pem. Download it and point your client at it:

  • MySQL or MariaDB: mysql -h <server> -P <port> -u admin -p --ssl-ca=/path/to/global-bundle.pem main
  • PostgreSQL: psql "host=<server> port=<port> user=pdmaster dbname=main sslmode=verify-full sslrootcert=/path/to/global-bundle.pem"

Keep encryption on in your application too.

Step 3: allow your servers

If your plan has a Firewall page, only the IP addresses listed under Allowed IPs (firewall) can connect, and with none listed the database isn’t reachable from outside. Enter an IPv4 address or range, such as 203.0.113.10 or 203.0.113.0/24, and click Allow this IP. Changes can take a few minutes.

Troubleshooting

  • Connection refused: check the status is Running and your IP is allowed.
  • Certificate errors: make sure your client uses the downloaded bundle.
  • Wrong password: copy it again from Connection details, or reset it from Controls.

Questions

Can I choose the database name or username?

Your database is created as main, with the username shown in Connection details.

Where does my database run?

In London.

See managed databases in London.

Table of Contents

Get your website online with PD Hosting

UK hosting, domains and support from a real team. From a first site to a full server.

Terms and Conditions  ·  Privacy Policy

PD Hosting is the trading name of Projektif Digital Ltd, registered in England and Wales, company number 12482555.