Migrating to MariaDB from MySQL

309

MariaDB logoEver since Oracle bought MySQL a fair number of MySQL users started looking for an alternative, due mainly to doubts that Oracle would be a good steward of a key software project. Let’s go back in time a little bit to understand what’s at stake, and look at the reasons to move away from, or stay with MySQL.

Born in the Last Millennium

Once upon a time there was a speedy relational database called MySQL. It was invented by a Swedish company, MySQL AB, which was founded by David Axmark, Allan Larsson and Michael “Monty” Widenius. It is named for Widenius’ daughter, My. MySQL was born about the same time as the World Wide Web, in 1994. It was popular from its inception and quickly became a standard part of the LAMP stack (Linux, Apache, MySQL, Perl/PHP/Python) that powers most Web sites. MySQL has been dual-licensed from the beginning: free for personal use, but you had to purchase a commercial license to use it on commercial sites or on Windows servers. In 2000 they changed the free license to the GPL, which meant that commercial users no longer had to purchase licenses. MySQL AB took a huge financial hit from this, losing as much as 80 percent of revenues by some accounts.

But, to their credit, they stuck with the GPL. MÃ¥rten Mickos became CEO in 2001, and the company’s market reach and revenue steadily increased. But even though they were becoming dominant when measured by installations (about a third of the total market share), their revenues were still smallish– for example, they grossed about $50 million in 2007, which to me is a nice pile of money, but to industry giants like Microsoft and Oracle it’s a rounding error. Oracle looked upon MySQL and decided they had to have it, and started making purchase overtures around 2006. MySQL AB said no.

In 2007 MySQL AB raked in a cool $75 million. In 2008 Sun Microsystems bought them for approximately $1 billion. At the time I thought that was a heck of a lot of money when Sun could have forked it without buying it. Though purchasing the whole company meant buying the talent that built MySQL. But Widenius and Axmark didn’t last long at Sun and left in 2008, with many public complaints. Widenius was a vocal critic of Sun’s MySQL 5.1 release and called it buggy and crashy. Then Mickos left in 2009, and the original MySQL visionaries were gone.

Oracle Looms Like a Massive Blimp Darkening the Sky

In 2009 Oracle stunned both the geek- and blogospheres (I always wanted to use those words) by announcing it was going to purchase Sun Microsystems for a cool $7.4 billion. Monty Widenius, in one of the most amazing cases of seller’s remorse ever, arose in a mighty dudgeon and tried to derail the deal with his “Save MySQL” campaign. He urged people to write to the European Union and ask them to either shoot down the whole deal, or require Oracle to obey certain conditions. MySQL was firmly entrenched as an extremely important piece of technology, the foundation of the Internet and of many private businesses, and he feared that Oracle would not be a good steward of MySQL, but would kill it, or close the source.

The deal went through anyway and Oracle, at last, owned MySQL.

And Lo, MariaDB

Monty did not retire to count his giant pile of Sun money, but instead forked MySQL and created MariaDB in 2009. (Fortunately for his naming convention he has another daughter, Maria.) MariaDB is a non-commercial community venture, always free software and always free of cost, though donations are welcome. MariaDB is now managed by the MariaDB Foundation, which is led by Michael Widenius, David Axmark, and Allan Larsson (sound familiar?). So they created it, sold it, and got it back for free, which makes this the all-time having-your-cake-and-eating-it winner.

What if you want commercial support? Then you talk to the nice people at SkySQL, who provide support and custom engineering for MariaDB, and migration assistance from MySQL.

MariaDB has a different numbered versioning system than MySQL, but otherwise it aims to be a drop-in replacement for MySQL, with complete binary compatibility with all APIs and protocols, all MySQL connectors (such as PHP, Perl, Python, Ruby, and so on), and important tools like mysql-client. So how do you migrate? Uninstall MySQL and install MariaDB. Really, that’s all there is to it– in theory, anyway. I’ve done it a few times on smallish simple databases and it worked like a charm. For large complex systems, who knows. Be sure to study MariaDB is a binary drop in replacement for MySQL before you try it.

Why MariaDB

So why would you even think of migrating away from MySQL to MariaDB? There are a number of reasons. Mainly because as a non-profit community project MariaDB is not subject to the whims of a single vendor. This is a very big advantage, because one of the top reasons to use free/open source software is you don’t get locked in to any particular vendor. MariaDB has more features such as multiple storage engines, subqueries, an Optimizer that improves performance, and better replication. MariaDB is MySQL with improved and extra features, and even though the Foundation wants to maintain binary compatibility I expect increasing divergence, and someday they’re going to have to leave MySQL behind.

Ahem PostgreSQL

Yes, I am one of those lonely nerds who adores PostgreSQL and wishes MySQL were not so dominant. Because the world is full of MySQL, and so we database nerds must be fluent in MySQL. Me, if I’m starting from scratch I want PostgreSQL. But not migrate from MySQL or any other RDBMS, because that is a giant and error-prone task.

Thank you to Jeff Cogswell for his excellent MariaDB vs. MySQL: A Comparison. You may also enjoy the informative MariaDB vs. MySQL which details changes you’ll see as you use it. For a good introduction to PostgreSQL try my series Crash course in PostgreSQL, part 1 and Crash course in PostgreSQL, part 2.