You've brought up the server, run the installation script, and now you're staring at the screen: install mariadb-server or mysql-server? If you've come from shared hosting, you probably saw nothing but a "Create Database" button until yesterday, and now you have to decide for yourself. The wrong decision doesn't show itself immediately either; three months later, when you want to upgrade or activate a plugin, it becomes clear.
The good news is that in 90% of cases the answer is simple. The bad news is that the remaining 10% is exactly where real projects crash and burn.
MariaDB or MySQL; Where the Split Story Began
Until 2009, these two were one and the same. After MySQL was acquired by Oracle, the project's core team forked it and created MariaDB. For years, the two were almost the same code, which led many to think the difference was just in the name. From MySQL 8.0 onward, that assumption became wrong.
Today we have two separate development lines. MySQL 8.0 and 8.4 went their own way; MariaDB from 10.2 onward went another. Both understand standard SQL, both have InnoDB (in MariaDB, a version called XtraDB, which is an older fork of InnoDB), but in storage engine details, functions, and optimizer behavior, they've drifted apart.
Differences You'll Actually Run Into
- JSON: In MySQL, we have a real
JSONdata type with path indexing. In MariaDB, that sameJSONis actuallyLONGTEXTwith a CHECK constraint. If you run heavy queries on a JSON column, you'll feel this difference. - CTEs and window functions: Both have them, but MySQL from 8.0 and MariaDB from 10.2. If you're on an older version, your analytical queries won't work.
- Storage engines: MariaDB includes Aria, ColumnStore, and MyRocks engines in the main package. MySQL has to go for commercial versions or plugins for equivalents.
- Replication: MariaDB uses GTID in its own format, which is not compatible with GTID in MySQL. This means you can't connect a MariaDB slave to a MySQL master and expect it to work painlessly.
Which Should I Choose? A Practical Rule
If your project runs on WordPress, Joomla, or any common CMS, go with MariaDB. The reason isn't bias; the reason is that most hosting panels and auto-installer scripts have been tested on MariaDB for years, and you'll have the least friction. On an Iran VPS, installing MariaDB is done with a single apt install mariadb-server and needs no extra configuration.
If you're locked into MySQL 8.0, you usually have a specific reason: a commercial application that officially only supports MySQL, or a team that has worked for years with MySQL-specific monitoring tools. In that case, stay with MySQL. Changing it just to be "free" isn't worth the risk.
| Criterion | MariaDB | MySQL |
|---|---|---|
| Compatibility with common CMS | Very high | High |
| Real JSON data type | No (simulated) | Yes |
| Built-in storage engines | More | Fewer |
| Commercial support | More limited | More extensive |
| Speed under light OLTP loads | Usually equal or slightly better | Usually equal |
Migrating from One to the Other; Where Everyone Gets Stuck
Migrating from MariaDB to MySQL (or vice versa) is theoretically a mysqldump. In practice, three things get in your way.
First: Check the Versions, Not Just the Name
mysql --version
mariadb --version
SELECT VERSION();
If the output is 10.11.6-MariaDB, you're on MariaDB even if you ran the mysql command. This is the most confusing part of the whole story: binaries and clients in MariaDB still carry the mysql name to maintain compatibility. Many people think they have MySQL when they actually have MariaDB.
Second: Don't Restore the Dump Blindly
mysqldump --single-transaction --routines --triggers --events \
--default-character-set=utf8mb4 mydb > mydb.sql
The --single-transaction flag prevents table locking for InnoDB tables and is critical on a live site. Without it, during peak traffic hours a table gets locked and the site goes down for several minutes. If you have MyISAM tables, this flag won't help and you'll need a maintenance window.
Third: Take Charset Seriously
If your database was created with the old utf8 (which is actually three-byte), do the migration to utf8mb4 right now. Emojis and some Persian characters aren't stored correctly in three-byte utf8 and will appear as ???? after migration. This error doesn't show up in logs; you only see it on the site.
Here's where people make mistakes: many take the dump with --default-character-set=latin1 because that's what the old server config had, then restore it on the new server whose default is utf8mb4, and the entire Persian text gets scrambled. The symptom is that the site comes up, the tables look healthy, but everything looks like سلام. The right way is to read the source charset from SHOW CREATE DATABASE and specify that same one in the dump.
Performance; What the Real Numbers Mean
In light OLTP benchmarks, the difference between the two is usually under 5%. That means if your site handles 200 queries per second, changing the database won't double its speed. What actually changes speed is three things: proper indexing, the size of innodb_buffer_pool_size, and the disk.
On a server with 8 GB of RAM, the default innodb_buffer_pool_size in MariaDB is around 128 MB. This number is a disaster for a medium WordPress site. Set it to 4 to 5 GB and see the difference in TTFB. If you're on a SATA disk, migrating to NVMe will give you more speed than changing the database.
To see where the bottleneck really is, measure the current state before making any changes. Network tools and speed tests can show whether the problem is the database or the web layer. If you have high TTFB but queries are fast, the problem is probably elsewhere and you're wasting your time on the database.
When the Project Grows
At small and medium scale, the choice between these two is almost irrelevant. At large scale, architecture matters more than brand. Read replicas, caching at the application layer, and partitioning large tables will serve you better than the engine choice.
If you've reached the point where one server can't keep up, think about server architecture before changing the database. For heavy database loads, separating the database onto a dedicated physical machine with NVMe disk is usually more effective than any software change. ServerNet's documentation and knowledge base also has recommended configurations for various loads that can be a good starting point.
One point that's rarely mentioned: MariaDB in its recent versions has changed some optimizer behaviors that can perform slower than MySQL 8.0 on complex queries with many JOINs. If your application has heavy analytical queries, test with real data before migrating, not with a sample dataset.
Frequently Asked Questions
Is MariaDB a Complete Replacement for MySQL?
For most web use cases, yes. MariaDB was built to be a drop-in replacement, and most code that works with MySQL runs on it without changes. But "most" is different from "all." If you use MySQL 8.0-specific features like the real JSON data type or its specific functions, it's not a complete replacement.
How Do I Know If My Server Has MySQL or MariaDB?
Run the mysql --version command. If you see the word MariaDB in the output, the server is MariaDB. You can also run SELECT VERSION(); inside the client. The important point is that having a binary named mysql doesn't mean the server is MySQL; MariaDB has kept the same names to maintain compatibility.
How Long Does Migrating from MySQL to MariaDB Take?
For a multi-gigabyte database, the dump and restore operation itself usually takes between 10 and 40 minutes, depending on disk speed and number of tables. But the real project time is mostly spent on testing. Practice the migration at least once on a staging environment before running it on production.
Can I Have Both on One Server?
Yes, but it's not recommended. Both listen on port 3306 and you'd have to move one to another port. On top of that, RAM consumption and management complexity go up. If you just want it for testing, it's better to use a separate container so the main environment stays untouched.
The final decision is simple: if you don't have a specific reason for MySQL, go with MariaDB and spend your time on tuning innodb_buffer_pool_size and indexing. Those two will change your site's speed more than any debate about database brand.
Comments 0
No comments yet — be the first!