DocsDatabases

Databases

Create MariaDB, PostgreSQL, MongoDB and Redis databases per account, allow remote access by IP, schedule backups and restores, open Adminer, and use external database servers.

The Databases page lists every database of the account, whatever the engine. Each database gets its own user with full privileges on that database only, and Redis databases get their own isolated key namespace.

Database engines (administrator)

MariaDB is the default engine. Administrators install the others from the Database servers card on the Databases page, or from Components:

Engine Port (local) Notes
MariaDB 3306 MySQL-compatible. Used by WordPress, Laravel and most PHP apps.
PostgreSQL 5432
MongoDB 27017 Requires a CPU with AVX; on Debian, packages exist for amd64 only. The card explains when the server cannot run it.
Redis 6379 Per-account namespaces with their own password. Also used by the WordPress object cache and Laravel deploys.

Every engine costs memory, so install only what your customers use.

Create a database

  1. Click New database.
  2. If external servers are configured, choose where to Create on: This server or an external server.
  3. Pick the engine.
  4. Enter the Database name. It is always prefixed with the account name (alice_ + shop = alice_shop): lowercase letters, digits and underscore, 32 characters at most in total. The database user has the same name.
  5. Enter or generate a Password (8 to 128 characters). For Redis, a strong password is generated automatically.
  6. Optionally Link to website, so the database appears on that website's Overview tab and can be deleted together with it.
  7. Click Create and store the password: it is not shown again.

The Database credentials dialog shows the host (127.0.0.1), name, user and a connection string:

mysql://alice_shop:<password>@127.0.0.1:3306/alice_shop
postgresql://alice_app:<password>@127.0.0.1:5432/alice_app
mongodb://alice_data:<password>@127.0.0.1:27017/alice_data
redis://alice_cache:<password>@127.0.0.1:6379   (key prefix "alice_cache:")

For Redis, your keys must start with the namespace prefix (alice_cache:); other keys and administrative commands are denied.

The number of databases is limited by the account's package. On the Free license, the whole server can have 10 databases.

Use Reset password to set a new password (applications using the old one stop working until you update them) and Delete to remove the database and all its data.

Remote access

By default, databases accept connections from the server itself only. To connect from your office or another server (MariaDB and PostgreSQL):

  1. In the database's menu, open Remote access.
  2. Enter the Allowed IP addresses / networks, one per line, for example 198.51.100.7 or 198.51.100.0/24.
  3. Click Save and use the Remote connection string shown in the dialog.

The firewall is opened only for these addresses. Up to 20 entries per database are allowed, and networks may not be larger than /16 (IPv4) or /48 (IPv6); "allow from anywhere" is not possible. Leave the list empty to return to local connections only.

Export, import and backups

  • Export (backup) writes a dump to ~/backups/db of the account.
  • Import / restore loads a dump from ~/backups/db or one you upload (.sql or .sql.gz; MongoDB uses .archive.gz). Tables or collections with the same names are replaced.
  • Redis data is not exported or backed up.

Scheduled backups and one-click restore

Open Backups in a database's menu:

  1. Choose an Automatic backup schedule: Off, Every hour, Every 6 hours or Every day.
  2. Set how many backups to Keep (1 to 168).
  3. Click Save, or Back up now for an immediate copy.

Each backup is listed with its time, type (manual, scheduled or before restore) and size. Restore replaces the database with the chosen backup; the current data is backed up first, so a restore can be undone. When the administrator has configured remote S3 backups, copies are also sent to S3.

Database backups are also included in the account's full backups (Backups).

Adminer

Adminer is a web interface for MariaDB and PostgreSQL databases. Administrators install it from the Database servers card or Components; it runs on port 8889.

Once installed, each MariaDB and PostgreSQL database has an Adminer link that opens Adminer with the server, user and database already filled in: enter the database password to continue. Adminer can only be reached by browsers that hold a valid panel session, and its PHP runs as a dedicated user with no access to hosting files.

External database servers (administrator)

Connect a MySQL/MariaDB or PostgreSQL server that runs elsewhere, for example a managed cloud database, so databases can be created there:

  1. On the Databases page, in External database servers, click Add server.
  2. Enter a name, engine, host, port and an Admin account that can create databases and users.
  3. Choose the encryption: TLS required, TLS + verify certificate or No encryption.
  4. Tick Customers may use it to offer it to customers; otherwise it is admin only.
  5. For MySQL/MariaDB, Allow connections from any address controls the database users' host. Off, users accept connections from this server only, so a leaked password is useless anywhere else.
  6. Click Connect & add. The connection is tested before saving, and the admin password is never shown again.

When creating a database on an external server, its password is generated and shown once. Export/import, remote access and automatic backups do not apply to databases on external servers: use your database provider's backups.


← DNS FTP and SFTP →