Skip to content

MariaDB on a VPS

Drop-in MySQL replacement

Category
Databases
Hosting
Databases
Author
MariaDB Foundation
License
GPL-2.0
Version
12.3.3

The script is free · VPS from $4.63 per month · installs in about 60 seconds

Install over SSH

root@vps:~# command -v docker >/dev/null || curl -fsSL https://get.docker.com | sh; P=$(openssl rand -hex 16); echo "$P" > /root/mariadb-root-password && chmod 600 /root/mariadb-root-password && docker run -d --name mariadb --restart unless-stopped -p 127.0.0.1:3306:3306 -e MARIADB_ROOT_PASSWORD=$P -v mariadb-data:/var/lib/mysql mariadb:lts

  • SystemUbuntu 24.04 · x86_64ok
  • Sourcegithub.com/MariaDB/serverok
  • Version12.3.3ok
  • Port3306/tcplisten

✓ MariaDB 12.3.3 installed · about 60 seconds

root@vps:~#

Install command from the library. Output is shortened and may differ on your server.

What it is

  • SQL
  • MySQL-compatible
  • Database

MariaDB is a fork of MySQL by its original creators, fully open and compatible with MySQL clients. It is the default database in Debian and many hosting panels.

It suits WordPress, Joomla, PHP projects and bots: apps written for MySQL usually work without changes.

The command runs the official image of the LTS branch. The port is reachable only from the server, and a random root password is saved to /root/mariadb-root-password.

  • Compatible with MySQL clients and drivers
  • LTS branch with long-term support
  • InnoDB, Aria, ColumnStore engines
  • Replication and Galera Cluster
  • Port closed to the outside by default

Recommended plan

For MariaDB: at least 2 vCPU, 3 GB RAM and 45 GB NVMe.

Minimum to run
1 vCPU · 1 GB RAM · 10 GB disk
Systems
Ubuntu 22.04 · Ubuntu 24.04 · Debian 12

How to install

Three steps in the bot or one command over SSH; installation takes about 60 seconds.

  1. 01

    Choose a plan in the bot

    Open @ExpressHost_bot and pay for a VPS. The server will be ready in about 60 seconds.

  2. 02

    Add MariaDB

    At the “Add-ons” step pick the script from the library, or run it later: Server settings → Scripts.

  3. 03

    The root password is in /root/mariadb-root-password

    The bot will send the server address and login details to the chat.

Manually over SSH

Connect to the server as root and run the command. Supported systems: Ubuntu 22.04, Ubuntu 24.04, Debian 12.

Install command
command -v docker >/dev/null || curl -fsSL https://get.docker.com | sh; P=$(openssl rand -hex 16); echo "$P" > /root/mariadb-root-password && chmod 600 /root/mariadb-root-password && docker run -d --name mariadb --restart unless-stopped -p 127.0.0.1:3306:3306 -e MARIADB_ROOT_PASSWORD=$P -v mariadb-data:/var/lib/mysql mariadb:lts

Ports

MariaDB ports
PortProtocolPurpose
3306tcpDatabase connections (127.0.0.1 only)

After installation

  1. 1.The root password is in /root/mariadb-root-password
  2. 2.Console: docker exec -it mariadb mariadb -uroot -p
  3. 3.Create a database and user for your app: CREATE DATABASE app; CREATE USER 'app'@'%' IDENTIFIED BY 'password'; GRANT ALL ON app.* TO 'app'@'%';

MariaDB FAQ

Didn’t find an answer? Message @ExpressHost_SupportBot.

MariaDB or MySQL?

For most PHP projects there is no difference. MariaDB is fully open and is the default in Debian; choose MySQL if your app specifically requires it.

Can I install it alongside MySQL?

Yes, but both use port 3306 by default. Publish one of them on a different port, e.g. -p 127.0.0.1:3307:3306.

Where is the data stored?

In the mariadb-data Docker volume. Backup: docker exec mariadb mariadb-dump -uroot -p --all-databases > backup.sql.

MariaDB installs at checkout — in the bot.