MariaDB vs MySQL, a more detailed than most comparison
Databases are ubiquitous in the IT industry and pervasive in every other one. MySQL was arguably the most used open source database in the world, up until Oracle acquired Sun Microsystems. That’s when the community decided to fork MySQL and form MariaDB, but what exactly is the difference? This article aims to shed light on the similarities and differences between the two from a beginner viewpoint.
MariaDB: story of a MySQL fork
MariaDB was born as a fork of MySQL that means they share the same code up to a certain point, that point was MySQL v5.1 (29 Sep 2009). The community decided to fork MySQL due to concerns about the Oracle acquisition and what MySQL would become.
Oracle was mainly a software company and most of its core business was at the time, well, databases. Oracle Database is the Oracle’s main product and it is often regarded as the standard database for the enterprise. With the acquisition of MySQL, the community feared that Oracle would limit the growth of what used to be a complete open source DBMS. The day Oracle announced the acquisition of Sun, Ulf Michael Widenius, the main author of MySQL, announced the fork of MySQL and the birth of MariaDB. The cofounder of MySQL took a handful of MySQl developers with him.
Oracle has since created derived products: MySQL Community Editions (the “original”, open source) and MySQL Standard, Enterprise editions that include closed source software and Oracle support.
A drop-in replacement
The main selling point of the newly born DBMS (Data Base Management System) was to keep compatibility with MySQL and to be a drop-in replacement for it.
Drop-in replacement means that a software using either won’t notice if you switch between the two and will continue working without any problem. This was done in order to provide users with an easy way to switch to the new software without disrupting their activities.
Maintaining MariaDB as a drop-in replacement was a right call to allow users to switch in the short period, but it would’ve been a double-edged sword in the long run: MariaDB would’ve had to implement every single change implemented by Oracle, and that would’ve defeated the original reason behind the fork. That’s why not all versions of MariaDB are compatible with MySQL (more in a while).
MariaDB, MySQL: storage engines
First and foremost MariaDB released Aria, a storage engine to replace the older, but still widely used, MyISAM. For a short while MariaDB used XtraDB (a storage engine from Percona) as default, to later return to InnoDB. It may not seem like a great feat now, but at the time MyISAM, the default MySQL storage engine, would employ table-wide locks that resulted in poor performance and query stacking.
In time MariaDB’s InnoDB, the current default engine, diverged substantially from MySQL’s InnoDB, leading to incompatibilities, up to the point that no version of MariaDB can be used as drop-in replacement for MySQL 8.
At the moment MariaDB supports the following engines:
- InnoDB (since version MariaDB 10.3 it has diverged substantially from MySQL’s implementation)
- follow this link for a full list.
While MySQL supports:
Notice that Memory, CSV, Archive, Blackhole, Merge, Federated, Example are also available in MariaDB.
The great dispute: Performance
I usually prefer to not speak when others with far more experience than me are speaking. The previous image comes from a benchmark performed by Axel Schwenke, Senior Software Engineer at MariaDB. You can find more here.
Availability in Linux distributions
Most Linux Distributions have silently switched from MySQL to MariaDB and even if you use your favorite package manager to install MySQL you may end up with a MariaDB installation. Nevertheless MySQL can be downloaded and installed on any Linux distribution, it is just not accessible as it used to be.
You can use MariaDB as drop-in replacement for many MySQL versions, except the latest MySQL 8.
- MariaDB versions 5.1, 5.2, 5.3 can replace MySQL 5.1 .
- version 5.5 can replace MySQL 5.5 .
- versions 10.0, 10.1 can replace MySQL 5.6 (some differences in InooDB).
- versions 10.2, 10.3, 10.4 can replace MySQL 5.7 (more differences in InnoDB).
Past this point, MariaDB and MySQL part ways, and there is no compatibility. For more information about compatibility you can take a look here.