MariaDB is a MySQL-compatible open-source database. Many applications require it, including websites, FiveM frameworks with oxmysql, Minecraft plugins like LuckPerms, and your own projects. With your own MariaDB server on your VPS, you decide which databases and users exist and who can access them.
In this guide, we’ll show you two ways to set it up: the easy way as a One-Click App, which automatically creates a database, user, and passwords, and the manual installation using Docker Compose on a Linux server.
With your VPS’s One-Click Apps, you can launch a standalone MariaDB server running version 11.8 (LTS). During installation, the app creates a database, a user, and secure passwords. The database is then accessible through your VPS’s IP address, and its data is stored persistently.
- A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. For instructions, see VPS: One-Click Apps.
- At least 512 MB RAM for MariaDB; 1 GB is recommended. Larger databases require more.
Do you actually need a separate database app? Many apps include their own database, such as ZAP Webspace with MariaDB and phpMyAdmin for your website. See Web Hosting: Set Up a Website with ZAP Webspace. The MariaDB app is intended for cases where a database needs to be accessible from outside, such as for a game server or an application on another server.
- Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
- Search for “MariaDB” in the App catalog and click Install next to MariaDB.
- Under App configuration, you can change two values. This is optional:
| Field | Default | Description |
|---|---|---|
MARIADB_DATABASE | app | Name of the database created during installation |
MARIADB_PORT | 3306 | Port used to access the database from outside |
- Click Queue installation. After about a minute, the app will be Online.
You don’t need a domain of your own; MariaDB doesn’t have a web interface. The app’s card shows the address where your database can be reached under Connection, for example, 123.123.123.123:3306.
The app generates users and passwords during installation. You can find them in the app’s settings (gear icon), under App environment > Automatically generated values. Click the eye icon to reveal a value or the copy icon to copy it.
| Value | Description |
|---|---|
SERVICE_USER_MARIADB | Username for your database; the default is zapx |
SERVICE_PASSWORD_MARIADB | Password for this user |
SERVICE_PASSWORD_MARIADBROOT | Password for the root user |
The zapx user has full access to the app database and cannot see any other databases. Use the root user to create additional databases and users, for example, in phpMyAdmin.
You’ll need the following details for each application that will use your database:
| Setting | Value |
|---|---|
| Host | IP address of your VPS |
| Port | 3306 or the value of MARIADB_PORT |
| Database | app or the value of MARIADB_DATABASE |
| Username and password | SERVICE_USER_MARIADB and SERVICE_PASSWORD_MARIADB |
For a FiveM server with oxmysql, the line in server.cfg would look like this, for example:
set mysql_connection_string "mysql://zapx:DEIN_PASSWORT@123.123.123.123:3306/app?charset=utf8mb4"
You can add a web interface for your database using the phpMyAdmin One-Click App. Enter your VPS’s IP address as the server. This also works when both apps are running on the same VPS. For instructions, see Set Up phpMyAdmin on a Linux Server.
The database is accessible over its port from anywhere on the internet. The generated passwords are long and random, but you should still restrict access: Create a rule under Network firewall on your VPS that only allows the database port to be accessed by the IP addresses that need to connect, such as your game server’s IP address.
- Backups: Export a backup of your database in phpMyAdmin using the Export tab, or on your own computer with
mariadb-dump -h 123.123.123.123 -u zapx -p app > backup.sql. - Updates: Open the app’s settings (gear icon) > App update and click Check for updates. If a new version is available, install it by clicking Apply update. Your data will be preserved.
- Uninstalling: When uninstalling under App actions > Uninstall app, you can also delete the data volumes. This permanently deletes all databases. Create a backup first.
The rest of this guide describes the manual installation of MariaDB 11.8 using Docker Compose on a Linux server, for example, on a dedicated server or if you want to configure everything yourself. This is based on the official guide to the MariaDB Docker image.
Install MariaDB without Docker If you want to install MariaDB directly using your system’s package manager, follow the steps in Set Up Databases on a Linux Server.
Docker and Docker Compose must be installed on your server. For instructions, see Set Up Docker on a Linux Server. Then create a folder for MariaDB and navigate to it:
mkdir -p /opt/mariadb && cd /opt/mariadb
Create the docker-compose.yml file with the following content using nano docker-compose.yml. Replace the passwords with your own secure values:
services:
mariadb:
image: mariadb:11.8
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: ein-sicheres-root-passwort
MARIADB_DATABASE: app
MARIADB_USER: appuser
MARIADB_PASSWORD: ein-sicheres-passwort
ports:
- "3306:3306"
volumes:
- mariadb-data:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 10
volumes:
mariadb-data:
On its first start, MariaDB creates the app database and the appuser user with full access to that database. The data is stored in the mariadb-data Docker volume and is preserved when you recreate the container.
Only make the database accessible from outside if necessary
With ports, the database is accessible from the internet on port 3306. If only an application on the same server uses the database, use "127.0.0.1:3306:3306" instead. Otherwise, use your firewall to restrict access to the port to the required IP addresses.
Start MariaDB in the background and check its status:
docker compose up -d
docker compose ps
Once the container is shown as healthy, log in to test it:
docker compose exec mariadb mariadb -u appuser -p app
Use exit to leave the database console.
Create a backup of all databases as follows:
docker compose exec -T mariadb sh -c 'mariadb-dump --all-databases -uroot -p"$MARIADB_ROOT_PASSWORD"' > backup.sql
To update within version 11.8, download the new image and recreate the container:
docker compose pull
docker compose up -d
If you want to upgrade to a new major version later, create a backup first, change the version in image, and add the MARIADB_AUTO_UPGRADE: "1" line under environment. MariaDB will then update the system tables automatically on startup.
With the One-Click App, you can have your own MariaDB database with ready-to-use credentials in a minute. With Docker Compose, you can set it up yourself in just a few steps. Secure access with a firewall and create regular backups. If you need help, our support team will be happy to assist.