Why host MariaDB on a VPS?
MariaDB is a community fork of MySQL, 100% open source, renowned for its performance, reliability and full compatibility with existing MySQL applications. Hosted on a VPS, it frees you from the restrictions of shared hosting: no imposed connection limits, no arbitrary quotas on database size, and the ability to finely tune InnoDB engine parameters according to your real load. You keep control of your backups, your users and network security, without depending on a third-party provider for every maintenance operation.
Two LTS versions are available today: MariaDB 11.4 LTS (released May 2024, support guaranteed until 2028+) and MariaDB 10.11 LTS (support until February 2028). Both are stable for production; 11.4 notably brings the definitive shift from the mysql client to mariadb, better thread parallelism and InnoDB improvements.
What you can do with MariaDB on your VPS
- Host several databases for different projects or clients on a single instance, with isolation per MariaDB user
- Connect your Laravel, Symfony, WordPress or any other framework application through the standard port 3306, locally or from a remote server secured by a firewall
- Run automated backups with
mariadb-dumpand store them compressed with configurable retention - Set up master-slave replication to ensure high availability or offload read-heavy workloads
- Optimise performance by adjusting
innodb_buffer_pool_size,innodb_log_file_sizeandmax_connectionsdirectly in/etc/mysql/conf.d/ - Manage your databases through graphical interfaces such as phpMyAdmin, Adminer or DBeaver connected remotely via a secure SSH tunnel
Prerequisites
Before you start, make sure you have the following:
- A ServOrbit VPS: 2 GB of RAM minimum (light use or testing), 4 GB recommended in production. MariaDB itself consumes little, but the InnoDB buffer pool (innodb_buffer_pool_size) should represent 60 to 70% of available RAM to be effective — on 2 GB, less than 1.2 GB remains after the operating system.
- SSH root access or sudo to your VPS.
- A recent MariaDB version: MariaDB 11.4 LTS (May 2024, support until 2028+) or MariaDB 10.11 LTS (support until February 2028). Avoid 10.6 and below in production: they are approaching end of support.
- An active firewall (UFW or equivalent): port 3306 must never be exposed directly to the Internet.
Install MariaDB on your ServOrbit VPS
Order a ServOrbit Cloud VPS
Head to /vps-cloud and choose the plan suited to your load. For a production MariaDB instance, a VPS with 2 vCPU and 4 GB of RAM is a good starting point. Complete the order and note the SSH credentials (IP, user, password or key) sent by email.
Connect to your VPS over SSH
Open a terminal and connect to your VPS:
ssh root@<your-ip>If you use an SSH key rather than a password:
ssh -i ~/.ssh/my_key root@<your-ip>Once connected, check system version and available resources:
free -mfor memory,nprocfor CPU cores.Open the Marketplace in your client area
Log in to your ServOrbit client area, then navigate to the 'My VPS' section. Select your newly ordered VPS and click the 'Marketplace' tab to access the catalogue of applications available as 1-click installs.
Select MariaDB and launch the installation
In the Marketplace, search for 'MariaDB' and click the application tile. Check the offered version (MariaDB 10.11 LTS or 11.4 LTS recommended), then click 'Install'. The system automatically provisions MariaDB on your VPS, configures the systemd service and generates a random root password provided to you at the end of the installation.
Secure the installation with mysql_secure_installation
From your SSH session, run:
mysql_secure_installationThis interactive script guides you through setting or strengthening the root password, removing anonymous users, disabling remote root login and dropping the test database. These steps are essential before any production use.
Connect to the MariaDB shell
Since MariaDB 11, the client is called
mariadb(no longermysql). Both work under 10.11, butmariadbis the canonical command:mariadb -u root -pEnter the root password set in the previous step. You are now in the interactive SQL shell (
MariaDB [(none)]>).Create a database with utf8mb4
Always create databases with
utf8mb4encoding andutf8mb4_unicode_cicollation for correct handling of all characters (including emojis):CREATE DATABASE my_app CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; SHOW DATABASES;SHOW DATABASES;confirms your database appears in the list.Create a dedicated application user
Never use
rootfrom your application. Create a user limited to your database:CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'strong_password'; GRANT ALL PRIVILEGES ON my_app.* TO 'appuser'@'localhost'; FLUSH PRIVILEGES;Your application can now connect via host
127.0.0.1, port3306, with these credentials.Verify MariaDB starts automatically
Ensure the service restarts after a VPS reboot:
systemctl enable mariadb systemctl status mariadbThe output should show
active (running). If the service is not enabled at startup,systemctl enable mariadbconfigures it.
Automated backups with mariadb-dump
A database without automated backups is a ticking time bomb. The following script creates a compressed nightly backup with 7-day retention.
Create the backup script at /usr/local/bin/backup-mariadb.sh:
#!/bin/bash
BACKUP_DIR="/var/backups/mariadb"
DATE=$(date +%Y%m%d_%H%M%S)
DB_USER="root"
DB_PASS="your_root_password"
RETENTION=7
mkdir -p "$BACKUP_DIR"
# List all databases (excluding system ones)
DATABASES=$(mariadb -u"$DB_USER" -p"$DB_PASS" -e "SHOW DATABASES;" 2>/dev/null | \
grep -vE "^(Database|information_schema|performance_schema|mysql|sys)$")
for DB in $DATABASES; do
mariadb-dump \
-u"$DB_USER" -p"$DB_PASS" \
--single-transaction \
--quick \
--routines \
--triggers \
"$DB" | gzip > "$BACKUP_DIR/${DB}_${DATE}.sql.gz"
done
# Remove backups older than RETENTION days
find "$BACKUP_DIR" -name "*.sql.gz" -mtime +$RETENTION -deleteMake the script executable and add a cron job to run it every night at 02:00:
chmod +x /usr/local/bin/backup-mariadb.sh
crontab -eAdd the following line:
0 2 * * * /usr/local/bin/backup-mariadb.sh >> /var/log/backup-mariadb.log 2>&1Why --single-transaction and --quick: --single-transaction takes a consistent snapshot without locking InnoDB tables (essential in production to avoid write blocks); --quick streams rows one at a time without loading them into memory, preventing RAM overflow on large tables.
To restore a database from a backup:
zcat /var/backups/mariadb/my_app_20261007_020000.sql.gz | mariadb -u root -p my_appOptimisation: configuring InnoDB
MariaDB's default configuration is very conservative (only a few tens of MB for innodb_buffer_pool_size). On a production VPS, tune InnoDB parameters to make full use of available memory.
Create the file /etc/mysql/conf.d/performance.cnf:
[mysqld]
# InnoDB buffer pool: 60-70% of total RAM
# On 4 GB RAM → 2.5 GB
innodb_buffer_pool_size = 2560M
# Log file size (recommended: 25% of pool)
innodb_log_file_size = 640M
# Number of log files (default 2, sufficient)
innodb_log_files_in_group = 2
# Query cache disabled on MariaDB 10.3+ (measured degradation)
query_cache_size = 0
query_cache_type = 0
# Simultaneous connections (adjust to real load)
max_connections = 150
# Slow query log (identify queries to optimise)
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /var/log/mysql/mariadb-slow.logAdjust innodb_buffer_pool_size according to your VPS RAM: on 2 GB, use 1.2 GB (1228M); on 8 GB, use 5.5 GB (5632M).
Then restart MariaDB to apply the configuration:
systemctl restart mariadbVerify the parameters were applied:
SHOW VARIABLES LIKE 'innodb_buffer_pool_size';
SHOW VARIABLES LIKE 'query_cache_size';Secure remote access
By default, MariaDB only listens on 127.0.0.1 — this is the secure default. For access from an application on another server, two approaches exist.
Option 1 — SSH tunnel (recommended, without opening port 3306)
From your local machine or application server:
ssh -L 3306:127.0.0.1:3306 -N root@<mariadb-vps-ip>Your application then connects to 127.0.0.1:3306 locally — the SSH tunnel encrypts the traffic. Add -f to put the tunnel in the background.
Option 2 — Inter-VPS connection with IP allowlisting
If your application runs on another ServOrbit VPS (e.g., a separate application VPS from the database VPS), open the port only for that server's private IP:
# In /etc/mysql/conf.d/network.cnf
[mysqld]
bind-address = 0.0.0.0# Allow only the application server IP
ufw allow from <app-ip> to any port 3306Create the MariaDB user limited to the application server's IP:
CREATE USER 'app'@'<app-ip>' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON my_app.* TO 'app'@'<app-ip>';
FLUSH PRIVILEGES;Never create a 'user'@'%' account (wildcard host): this allows connections from any IP — if port 3306 were accidentally opened, the account would be directly accessible from the Internet.
Troubleshooting
Here are the four most common errors when running MariaDB on a VPS, and how to resolve them.
1. Can't connect to local MariaDB server through socket
The MariaDB service is not running or the socket is missing.
systemctl status mariadb
systemctl start mariadbIf the service refuses to start, read the logs:
journalctl -xe -u mariadb --no-pager | tail -40Common cause: innodb_buffer_pool_size is too large for the available RAM — MariaDB stops immediately without an obvious message. Reduce the value in /etc/mysql/conf.d/performance.cnf.
2. Too many connections
The number of simultaneous connections has reached the limit. Increase max_connections in /etc/mysql/conf.d/performance.cnf then reload:
systemctl reload mariadbInspect active connections before increasing: SHOW PROCESSLIST; in the MariaDB shell. Hundreds of idle connections usually indicate a misconfigured connection pool on the application side.
3. Table '<name>' is marked as crashed
A MyISAM table is corrupt (system crash, power outage). Repair it:
mysqlcheck -u root -p --repair my_app table_nameIf you use InnoDB (the general case), this error is rare; InnoDB corruption is resolved by restoring a backup — another reason to enable automated backups.
4. Access denied for user 'root'@'localhost'
Forgotten root password or modified authentication plugin. Reset in skip-grant mode:
systemctl stop mariadb
mysqld_safe --skip-grant-tables &
mariadb -u rootThen in the MariaDB shell:
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
FLUSH PRIVILEGES;
EXIT;Restart MariaDB normally: systemctl restart mariadb.
MariaDB 11.4 LTS vs MariaDB 10.11 LTS vs MySQL 8.0
Scroll the table
| Criterion | MariaDB 11.4 LTS | MariaDB 10.11 LTS | MySQL 8.0 |
|---|---|---|---|
| Licence | GPL v2 (community) | GPL v2 (community) | GPL v2 / Commercial (Oracle) |
| Support until | 2028+ (LTS, May 2024) | February 2028 (LTS) | April 2026 (near EOL) |
| CLI client | `mariadb` (mysql deprecated) | `mariadb` and `mysql` | `mysql` |
| InnoDB performance | Improved (native threadpool) | Stable and proven | Good, Oracle-optimised |
| MySQL compatibility | Very high (drop-in) | Very high (drop-in) | Reference |
| Native JSON | Yes (MariaDB 10.2+) | Yes | Yes (JSON columns) |
| Recommendation | New projects, migrating from MySQL 8.0 | Existing production, maximum stability | If Oracle/cloud-specific dependency |
Never expose port 3306 directly on the internet: configure your firewall to allow MariaDB connections only locally (127.0.0.1) or through an SSH tunnel. Also enable the slow query log (slow_query_log = 1, long_query_time = 1) from the start to quickly identify queries to optimise before they affect your users.
The official documentation
For advanced configuration, tool-specific options and version changes, refer to the official MariaDB documentation. This guide covers going live on a ServOrbit VPS; the vendor documentation remains the reference for fine-tuning.