Basic operation tutorial for migrating databases from MySQL to MariaDB under Linux

  • 2020-11-30 08:36:30
  • OfStack

Since 2012, Wikipedia has begun the process of moving from MySQL to MariaDB, marking a major milestone in the evolution of wikimedia database architecture by porting the English and German versions of The Wikipedia database, Wikidata, to MariaDB 5.5.
For the past few years, Wikipedia 1 has used the MySQL 5.1 derivative of Facebook as our product database, building version number r3753. We are very pleased with the performance of the product and the Facebook has some of the best database engineers in the world who have brought many improvements to the MySQL ecosystem.

The current enhancements to the MariaDB optimizer, the XtraDB features of Percona, and Oracle 5.5 are reasons to consider upgrading. Just as importantly, as supporters of the free Culture movement, the Wikimedia Foundation has a strong desire to use free software projects, and does not want to use different licenses to distinguish between the free version and the enterprise version. We welcome and support the work of the MariaDB Foundation as a non-profit organization on the MySQL-related database community.

We did a lot of preparatory work before the official migration, including compatibility testing and performance testing. Please see the official instructions for details.

MySQL is the most popular open source relationship data in the world, taking its name from My, the eldest daughter of the founder, Michael "Monty" Widenius. In 2008, Sun acquired MySQL; In 2009, Oracle acquired Sun, leaving MySQL in the hands of oracle, which had a strained relationship with the open source community. Widenius and his old team created MariaDB, an offshoot of MySQL named after Widenius's teenage daughter, in early 2009, hoping to help MariaDB challenge Oracle's MySQL by retaining its core developers and growing community.

Oracle's deteriorating relationship with the open source community is prompting many distributions to replace MySQL with MariaDB. Wikipedia, a popular site that now USES MySQL, has also announced a move from MySQL to MariaDB, in part because Oracle's MySQL is available free and enterprise, and the new features in the Enterprise are not open source, while MariaDB has no such issues.

ArchLinux has announced that it will use MariaDB as the default package for MySQL, openSUSE has already used MariaDB by default in the recently released version 12.3, and even Fedora is considering switching to MariaDB...
Next, let's look at the actual method of migration from MySQL to MariaDB in Linux 1.

For Arch users, it's as simple as following the official news feed:


systemctl stop mysqld 
pacman -S mariadb libmariadbclient mariadb-clients 
systemctl start mysqld 
mysql_upgrade -p 

For openSUSE, it's even more foolproof. After all, it's the default: zypper in mariadb 1 sentence.

Debian/Ubuntu users are a little more complicated, but the process is smooth:

First of all to MariaDB official Repository Configuration Tool to choose a suitable source, then put to the address/etc apt/sources list at the bottom of the file:


# MariaDB 5.5 repository list - created 2013-03-26 14:20 UTC 
# http://mariadb.org/mariadb/repositories/ 
deb http://mirror2.hs-esslingen.de/mariadb/repo/5.5/debian squeeze main 
deb-src http://mirror2.hs-esslingen.de/mariadb/repo/5.5/debian squeeze main 

Next, execute the following command:

apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db 
apt-get update 
apt-get install mariadb-server mariadb-client 

MySQL (or Percona) is then automatically uninstalled and replaced with MariaDB, and in some circumstances these commands may need to be executed:


apt-get autoremove 
apt-get upgrade # or apt-get dist-upgrade 
mysql_upgrade -p 

And then we're done! Let's do it


Related articles: