Your site's databases: create, rotate and remove

Last verified

A site that runs code (Custom PHP, Laravel, Node.js or WordPress) can have a managed MariaDB or PostgreSQL database next to it. It is kept off the public internet, and your app gets the connection details as environment variables. Everything here is on the site's Databases tab. A static site runs no code, so its tab offers Create a site that can use a database instead.

Before you start

  • The site has to be live: until it has finished setting up, the tab says the database appears here as soon as it has.
  • To create, rotate or remove a database you need to be allowed to change the site's settings: an owner, admin or developer on the account, or a collaborator on the site.

Create the site's database

A WordPress site is built with its database already set up and connected, and a Laravel site gets one when it first goes live. A Custom PHP or Node.js site starts without one:

  1. Open Sites → your site → Databases.
  2. Under Add a database, pick an Engine: PostgreSQL (the default) or MariaDB.
  3. Press Add database — included.

It takes about a minute; the tab shows Setting up your database… meanwhile. Then it shows the host, port, database name and username. The first time you open the tab after that, it also shows the password, once:

Here is your database password — copy it now, we won't show it again.

Only people who may change the site's settings see it. Missed it? Rotate the password (below) to get a new one.

Your app does not need you to copy it. Under How your app reads this you see the variables we set inside your site, DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME and DB_PASSWORD, and your app picks them up on its own. Don't paste the password into a config file. If setting it up fails, the tab says why and offers Retry.

Rotate the password

Press Rotate password and confirm. We set a new password and your app picks up the new one within a minute. The tab shows the new password once, the same way, and the Password column counts up its version. Rotate when someone who knew the password leaves, or when it may have leaked.

Add another database

A site can have more than one database, each with its own name, engine, login and password. Your plan includes this many per site, counting the site's own database:

Plan Databases per site
Starter 1
Pro 3
Business 10

Each one beyond that is €3 per database / month. The heading of the Databases band shows how many the site uses.

  1. Under Add a database, pick the Engine.
  2. Type a Name: lowercase letters, digits and underscores, starting with a letter, for example analytics.
  3. Press Add database — included, or, beyond your plan, Add database · PRICE and confirm. It is added to your subscription straight away; you pay for the part of the period you use on your next invoice.

Adding a paid database is for an owner or billing contact of the account; anyone else sees what it costs and who can add it. If your last payment did not go through, update your payment method under Billing first.

Your app reads a further database from variables that start with its name: ANALYTICS_DB_HOST, ANALYTICS_DB_PASSWORD and so on, plus ANALYTICS_DATABASE_URL. How your app reads this under each database lists them.

Remove a database

You can remove the further databases you added. The site's own database is the one the app runs on, so it has no Remove button.

Caution: removing a database deletes its data. The dialog says: "Its data goes with it. We keep a copy for seven days, then it is gone for good." Make sure nothing still uses it first, and contact us within that time if you need it back.

  1. Press Remove next to the database.
  2. Type its name where the dialog asks, then press Remove database.

It stops counting towards your plan and your bill straight away.

Move data into it

To bring an existing database over from another host, press Move an existing database here under the site's own database. See Move an existing database into your site.

Look inside

  • Browse and query it, read-only, in Databases under Data.
  • Connect TablePlus, DBeaver or HeidiSQL through an SSH tunnel to the host and port shown on the tab. See SSH, SFTP and database access.

Stuck? Contact support — replies within one business day.