MySQL and MariaDB share a history, a client protocol and most of their SQL, so many apps run on either one. They are no longer identical, though, and switching later takes some care. This guide explains the real differences and gives a simple way to choose for your VPS.
Before you start
- Know which apps you plan to run. The app's own requirements matter more than anything else here.
- Check what your Linux distribution ships, since the packaged option is usually the easiest to keep updated.
- Plan to install only one of the two on a server. They use the same port (3306) and the same default data folder.
Where they come from
MySQL is developed by Oracle. The free Community Edition is open source under the GPLv2. Oracle also sells a commercial Enterprise Edition with extra tools and support.
MariaDB began as a fork of MySQL, started by some of MySQL's original developers around the time Oracle bought Sun Microsystems, MySQL's owner. The server is open source under the GPLv2. It is developed by MariaDB plc together with the non-profit MariaDB Foundation.
For a typical VPS, both servers are free to use. Licensing only becomes a real question if you plan to embed or redistribute the database inside software you sell. In that case, read the vendor's licence terms or ask a lawyer.
Compatibility
For everyday use, the two are close:
- The same
mysqlclient protocol, so PHP'smysqliand PDO, Python, Node.js and other drivers connect to either. - The same core SQL: tables, indexes, joins, transactions and InnoDB as the default storage engine.
- Similar tools: both include a dump tool (
mysqldump, ormariadb-dumpon MariaDB) and a command-line client.
The differences show up in newer features:
- JSON: MySQL stores JSON in a binary format. MariaDB treats
JSONas an alias for a text column with a validity check. Most apps do not notice, but heavy JSON queries can behave differently. - Authentication: MySQL 8 uses
caching_sha2_passwordby default. MariaDB uses other plugins, such asmysql_native_password,ed25519andunix_socket. Old client libraries can struggle with MySQL's default. - Collations: MySQL 8 defaults to collations such as
utf8mb4_0900_ai_ci, which some MariaDB versions do not recognise. A dump from MySQL 8 may need its collations changed before it imports into MariaDB. - Replication: the two use different GTID formats, so mixing them in one replication setup is limited.
Note: Moving from MySQL 8 to MariaDB, or back, is not an in-place upgrade. Plan it as a dump and restore onto a fresh server, and test the app before you switch over.
Features that differ
Found in MariaDB community releases:
- A built-in thread pool, which helps with many short connections.
- System-versioned tables, which keep the history of every row.
- Sequences, and extra storage engines such as Aria.
- Galera Cluster for multi-primary clustering, included with the server.
Found in MySQL community releases:
- Group Replication and InnoDB Cluster for high availability.
- The binary JSON type and a document store interface.
- Tight integration with Oracle's own tooling and cloud services.
On a single VPS running a website or an app, you will rarely use any of these. Both servers perform well for typical web workloads. Your configuration, indexes and queries matter far more than the brand.
Release and support model
Both projects publish long-term support releases alongside shorter-lived feature releases:
- MySQL has LTS releases, such as 8.4, and Innovation releases that add features more often but are supported for a short time.
- MariaDB has long-term releases plus short-term releases between them.
Support periods change, so check the current lifecycle pages on mysql.com and mariadb.org before you pick a version. For a server you want to set and forget, choose an LTS release.
What your distribution ships also matters, because the packaged version is patched with normal system updates:
- Ubuntu 22.04 and 24.04: both
mysql-serverandmariadb-serverare available. - Debian 12: MariaDB only. MySQL needs Oracle's APT repository.
- AlmaLinux and Rocky Linux 8 and 9: both are in AppStream, with MariaDB the more common choice.
Which one should you use?
A simple rule set:
- Follow the app. If the app's documentation names one, use it. Some apps rely on MySQL-only features or test mainly on one server.
- WordPress, Joomla, Drupal, Nextcloud and most PHP apps: both work. Check the app's current requirements page for the minimum versions, then use whichever your distribution ships.
- Debian, AlmaLinux or Rocky Linux: MariaDB is the native, low-effort choice.
- Ubuntu: either. Pick MySQL if you want to match a managed MySQL service you use elsewhere, or MariaDB if your other servers run it.
- Existing data: stay with what the data came from. Switching engines adds risk with no clear gain for most sites.
Check it works
Whatever you install, confirm which server is actually running, because the commands and package names look alike:
mysql --versionSELECT VERSION();A MariaDB server includes MariaDB in the version string. A MySQL server shows only the number, such as 8.4.x.
Troubleshooting
- App says "unsupported database version": compare its requirements page with
SELECT VERSION;. Upgrade within the same engine, not by switching engines. - Import fails with
Unknown collation: 'utf8mb4_0900_ai_ci': the dump came from MySQL 8 and the target is MariaDB. Replace the collation withutf8mb4_unicode_ciin a copy of the dump, then import again. - Old PHP app cannot log in to MySQL 8: its client library does not support
caching_sha2_password. Update the app or its PHP version rather than weakening authentication. - Package conflicts when installing: one engine is already present. Remove it only after taking a backup.
Next steps
- Install MySQL: Install MySQL 8.4 on Ubuntu and Debian.
- Install MariaDB: Install MariaDB on AlmaLinux and Rocky Linux.
- Running WordPress? Follow install WordPress on a LEMP stack.
