A hosting panel for the AI era: vibe-code it, push to GitHub, it's live.Explore →
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.

Database root access

Hosting customers do not get database root

ZoPanel does not give hosting customers the MariaDB or PostgreSQL root account. Database root can read and delete every customer's databases on the server, and can change the whole server (global variables, writing files). Giving it to one customer would break the isolation between accounts. cPanel, DirectAdmin and Plesk work the same way.

What customers usually want root for is already possible in the panel:

You need How
Full control of your database The database's own user already has full privileges on it (tables, views, triggers, procedures, events).
Extra users with different privileges, such as a read-only user for reports The Database users card (MariaDB): create a user, then choose its databases and privileges.
One user for several databases The Database users card: grant the same user privileges on several of your databases.
Connect with Navicat, DBeaver, HeidiSQL or from another server Remote access by IP address.
Manage it in the browser Adminer, signed in with the database's user.
Import a dump with DEFINER=root or a definer from your old server Import it as usual: triggers, views, procedures and events are moved to your own user.
More databases New database, within your hosting package.

If your application really needs privileges over the whole database server (SUPER, global variables, replication, plugins), use a VPS of your own. Contact your hosting provider.

Server owners (administrator)

If you own the server ZoPanel runs on, you already have database root. Root signs in through the system socket, without a password. Connect to the server over SSH as root and run:

mysql                    # MariaDB
sudo -u postgres psql    # PostgreSQL

To use a desktop tool with administrator rights, create a separate admin user and connect through an SSH tunnel:

CREATE USER 'dbadmin'@'localhost' IDENTIFIED BY 'a-strong-password';
GRANT ALL PRIVILEGES ON *.* TO 'dbadmin'@'localhost' WITH GRANT OPTION;

In Navicat, DBeaver or HeidiSQL, choose an SSH connection (your server, user root or your SSH user), then set the database host to 127.0.0.1 and port 3306.

Do not switch the MariaDB root account to password sign-in and do not open port 3306 to the internet: the panel signs in as root through the socket to manage your customers' databases.

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 →