MariaDB vs. MySQL: Which is better for WordPress and are there differences?
You should have heard of MySQL before. It is a database system that is used in almost all WordPress installations. But does the name MariaDB also mean something to you? If not, then this article is made for you and you should read it carefully.
MySQL was a success and is owned by Oracle. Since 2009, a compatible version called MariaDB is being developed, which is open source and free. MariaDB is not only better in terms of licensing, but also much faster. That is why this SQL database is predominantly used today.
Why? Because WordPress can now be handled very individually. Just as NGINX vs Apache, or LiteSpeed can be used as server software, there are also different variations of database systems. Among others, there is MariaDB. Today I’ll explain what it’s all about and if it’s worth to use WordPress with MariaDB.
MariaDB for WordPress
MariaDB is a great fit for WordPress, as it is a fork of MySQL and offers similar syntax and functionality. In fact, many WordPress hosting providers offer MariaDB as a database option by default. Likewise, the service includes many improvements and optimizations over MySQL, especially in the areas of performance and scalability.
This is especially important for MariaDB WordPress websites that need to handle a large number of page views and users.
By using MariaDB, WordPress websites can run faster and more stable, which can lead to a better user experience and higher search engine rankings.
What exactly is MariaDB?
When MySQL was released as an open source database management system in the 90s, it was a huge success. So big, in fact, that the sale in 2008 to Sun Microsystems is said to have brought in one billion US dollars. Not bad, because even if the sum is considered unconfirmed, it was a classic exit.
MariaDB is a binary compatible 1:1 replacement for MySQL
mariadb.com
One of the founders and the core team of MySQL then left the company and founded a MySQL fork called MariaDB in 2009. The reason for this was that Sun was going to be acquired by Oracle, a controversial company in the open source community. So the team split off to pursue their own visions in the further development of MySQL. MariaDB was born.
By the way, the developer Michael Widenius is mainly responsible for MySQL and MariaDB.
Fun fact: MariaDB was borrowed from the first name of Michael “Monty” Widenius ‘ youngest daughter. The “My” from MySQL comes from the first name of his eldest daughter and in MaxDB you can find the name of his son.
In short, MariaDB was meant to ensure that there would always be a freely available version of MySQL, no matter what Oracle planned to do with it. Everything as open as possible and with public respositories, documentation of all steps and a fork of the MariaDB Foundation and the Corporation. The former for everything open source, the latter for everything commercial. In this way, there should never be a conflict of interest between open source and commercial from the beginning, unlike Oracle.
Timeline – The slow change
I also use the free database for all my websites as a matter of course. That’s why I looked up the changes the 30+ year old DB has undergone:
Differences between MariaDB and MySQL
MariaDB | MySQL | |
---|---|---|
Storage Engines | 12 new storage engines that you won’t find in MySQL. | Offers fewer options for storage. |
Speed improvements | MariaDB has higher speed compared to MySQL. | MySQL has slower speed |
Initial release | 2009 | 1995 |
Operating systems | FreeBSDLinuxmacOSSolarisWindows | FreeBSDLinuxOS XSolarisWindows |
Cache and Indexes | With MariaDB’s memory storage engine, an INSERT statement can complete 24% faster than in standard MySQL. | MySQL’s memory engine is slower compared to MariaDB. |
Features & Extensions | MariaDB has new features and extensions, including the JSON, WITH, and KILL statements. | The new MariaDB features are not included in MySQL. |
Monitoring | SQLyog | MySQL Workbench |
Routing | MariaDB MaxScale | Mysql Router |
Replication | Multi Master Replication | Master Slave Model |
Github Stars | 2.800 | 4.000 |
Github Forks | 868 | 1.600 |
MariaDB is a database management system just like MySQL and it is based on the same foundation. Not only did some of the original developers create the fork, it’s also a fork, so it’s a clear fork. However, that has since changed, as MariaDB has continued very much on its own over all this time.
Until version 7, was the system designed to be fully compatible. Whether from MySQL to MariaDB or vice versa, users should be able to switch easily and quickly without having to fear problems. This has changed somewhat since version 8, as MySQL and MariaDB have moved in different directions. However, most core aspects are still compatible.
MariaDB, unlike MySQL, focuses on flexibility, including the engines used. A database engine is a storage subsystem that is used for writing, reading, deleting and so on. The open source project allows here from InnoDB, over Spider or MyISAM almost all popular engines. If you are more interested in the potential differences, it is best to take a look here.
MariaDB and MySQL syntax comparison
MariaDB is a fork of MySQL, so both databases have almost identical syntax. Most SQL statements can be used in both databases, but there are some differences, especially in advanced functions.
Here are some examples of differences in syntax:
- Conversion of data types: In MariaDB, you can use the
CAST ()
command to convert one data type to another. In MySQL you use the CONVERT () command instead. - Window Functions: Window functions, such as
ROW_NUMBER ()
, that are not available in MySQL. - Storage engines: MariaDB offers more storage engines than MySQL, including XtraDB, TokuDB, Aria, and ColumnStore.
- JSON functions: MariaDB includes many functions for handling JSON data, including
JSON_EXTRACT ()
,JSON_ARRAY ()
,JSON_OBJECT ()
,JSON_ARRAYAGG ()
, andJSON_OBJECTAGG ()
. These functions are missing in MySQL. - Query Optimization: MariaDB includes optimizations that are not present in MySQL, such as support for subquery optimizations and the ability to split a query into multiple threads.
Although there are some differences, most SQL statements are the same in both databases. If you know MySQL, you should have no trouble adapting to MariaDB’s syntax.
MariaDB vs MySQL Performance
In terms of usability, there is no difference between MariaDB and MySQL, as they both fully support the SQL database language. The biggest difference is in performance.
MariaDB is supposed to be faster, has a clever optimizer for SQL queries and has a higher performance. This should work wonders for WordPress in particular. However, this point is difficult to compare. Among other things, because each database behaves differently, the engine is crucial and it seems difficult to measure pure performance against another system.
Therefore, we can say MariaDB is faster than MySQL.
MariaDB vs MySQL
As you can see on the graph, MySQL is still searched for much more often than MariaDB. I think this is mainly because MySQL is simply also used as a synonym for the fork. But many simply don’t know the difference. On top of that, many a hoster actually uses MariaDB, but still specifies MySQL in the package description.
You might also be interested in: Search and replace in MySQL
PostgreSQL as an alternative?
Yes, PostgreSQL is an alternative to MariaDB and MySQL. It is a relational database management system that offers similar functionality to the above systems, but also has some unique features.
PostgreSQL is known for its ability to handle complex queries and transactions, as well as support for advanced features such as geodata and full-text search. Compared to MySQL and MariaDB, PostgreSQL also offers better support for ACID transactions and higher data integrity. However, there are also differences in scalability and performance that should be considered depending on specific requirements.
Basically, Postgre is more suitable for larger solutions that run more than just a small WordPress blog. So for our requirements, not the first choice.
MariaDB and phpMyAdmin
If you use MySQL, you surely know phpMyAdmin, a very handy graphical interface for the database. The tool requires a web server, PHP and a browser.
But does phpMyAdmin also work for MariaDB?
Yes, you can use the web-based database administration tool for MariaDB as well.
MariaDB vs MySQL FAQ
During my training I spent many hours with the Microsoft SQL Server and subsequently also made two certifications on it. I still draw from this knowledge today when I do WordPress optimizations via SQL.
Conclusion about WordPress with MariaDB
In the end, it’s almost a matter of faith which is better or worse. In combination with WordPress, MariaDB works very well and extremely performant. Whether faster or not, everyone should test for themselves and decide which system they prefer. If all this means nothing to you, you should leave it alone anyway.
You should also keep in mind that MySQL is more or less a commercial product of Oracle. If you are fully committed to open source and want to support it, you are better off with MariaDB. This is also due to the fact that here is often more courageous or simply more agile optimization than is the case with MySQL.
For WordPress, MariaDB is mainly advantageous because of the performance and thus with regard to the database engines. But just as few people experience a performance boost when switching PHP versions (because it is only very marginal), switching from MySQL to MariaDB won’t turn your lame WordPress blog into a raging one. So it’s more about using the more “open” system.
Those who know their stuff will appreciate that. For all “normal” users, on the other hand, switching WordPress makes almost no sense. For large companies, on the other hand, it is also about money, because MySQL has been commercialized much more by Oracle. Nevertheless, in the end it is more a question of faith than a question of technical nature.
It looks good, so I installed MariaDB. But I already had MySQL running a WordPress instance. The MariaDB installation warned me it was going to change the — port? Not sure — for accessing MySQL to avoid a conflict. There was no way to back out; I hit ‘Esc’ instead of pressing ‘OK’, but the change happened anyway. There was a note about using ‘mysqldump’ or, presumably, some other tool to export the MySQL data. But I don’t know how to find it to do that. I do have the tool ‘WP-CLI’ installed on my system. Do you have a quick remark on how I can proceed with least pain?
I am root; it’s a Ubuntu 20.04 cloud server.
spamless@rubicon:~$ uname -a
Linux rubicon 5.15.0-1011-oracle #15-Ubuntu SMP Fri Jun 10 12:21:49 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
Hello!
Sorry, I can’t give Linux support.
But do a backup, before changing anything.
Jochen
Now I understand why my woocommerce site going so slow after changing to the MySQL. I think will be back to the mariaDB. Thank you
Hey Pandu,
not necessary, it can also be the MySQL configuration.
But yes, mariaDB is the better option.
Jochen
I received an email from my hosting company regarding a change in server configuration, with MySQL to be replaced with MariaDB. Google guided me here. Thank you for the informative article. I liked the fun facts too.