All chapters

Databases

A database belongs to a site: the sign-in it creates is that site's. cpleks creates MariaDB or MySQL databases and PostgreSQL databases, shows each password once, takes a copy before it deletes one, and includes every database in the backups.

Install a database server

A fresh server has none. On Modules ▸ Database servers, an administrator installs one:

  • MariaDB: the MySQL-compatible server WordPress and most PHP applications expect.
  • MySQL: Oracle's MySQL 8.4, in the same slot MariaDB would fill. A server runs one or the other.
  • PostgreSQL: for applications written for it. It runs beside MariaDB or MySQL.
  • SQLite needs no server (a database in a file), and MongoDB has its own card.

Installing a database server opens no port: sites reach it over this machine's own loopback, never from outside. When it is in, the card shows ON and the version it answers with.

The Database servers group on the Modules screen: MariaDB and PostgreSQL ON with their versions, SQLite installed, and MySQL and MongoDB with an Install button each.
Database servers on the Modules screen.

Create a database

  1. Open the site and its Databases tab (or Databases in the rail), and under Make a new database press Create.
  2. Which site uses it: every database a site uses shares one sign-in, so this also decides which password opens it.
  3. Which server, when the server runs more than one.
  4. Short name: lowercase letters and digits, starting with a letter, up to 24 characters. The server puts the hosting account's number in front of it (for example u1_shop); that prefix keeps your databases apart from every other account's and cannot be edited.
  5. Press Create database.
The New database dialog: the site that uses it, the server (MariaDB), the short name news, and the name it will be given, u1_news.
A short name and the site that uses it. The panel makes the sign-in at the same time.

The password is shown once

The next screen shows what the site needs in its configuration file: Database name, User name and Password, each with a Copy button. Copy the password now. The panel keeps no copy of it, not in its database and not in a backup, and there is no way to show it again.

If the site already had a database, the new one uses the same sign-in and the panel says No new password, and none is needed: use the user name and password the site already has.

The Databases tab listing u1_blog on PostgreSQL and u1_main and u1_shop on MariaDB, each marked HEALTHY with Sign-in details, Download a copy and Remove.
The Databases tab on the test machine: every database of the hosting account, each naming the site that uses it and the server it is on.

Change the password

Open Sign-in details on the database and press Change the password. The panel asks you to confirm that you have the site's configuration open (wp-config.php for WordPress), because the site cannot reach its database until the new password is in it. The new password is shown once, like the first one.

Take a copy

Download a copy gives you a fresh dump of the database, taken now, as one .sql file. When the database server is stopped or the schema is missing, the button is greyed out and says why.

Remove a database

Press Remove and type the database's name to confirm. Before removing it, the server dumps it into a backup set, checks the dump is complete, and keeps that set out of the normal rotation, so it is still there a month later. Getting a MariaDB or MySQL database back is two deliberate steps: create a database with the same name, then restore that set into it from the Backups screen. A PostgreSQL database is copied the same way, but cannot yet be restored from the panel (Backups and restore).

What is not here

  • Uploading a database. There is no import of an .sql file from your computer; a database comes back from this server's own backup sets (Backups and restore).
  • A table browser. The panel has no SQL browser yet, so Browse tables is greyed out. Your application's own tools work as usual.