As you may already know, MariaDB is rapidly becoming the default database server on Linux systems, including Ubuntu. Over the past years, MySQL was the undisputed database king for all Linux distributions. After Oracle Corporation purchased the previous parent company of MySQL and made some controversial licensing changes, the open-source community gradually started drifting away from MySQL towards MariaDB. MariaDB is a drop-in replacement for MySQL. This means it operates and functions like MySQL. If you remove MySQL and install MariaDB, applications that depended on MySQL won’t know the difference after installing MariaDB. For the tutorial to be applied, you must already have MySQL installed on Ubuntu

Removing MySQL Database Server

To get rid of MySQL from Ubuntu, run the commands below. After running the above commands, continue below to install the MariaDB database server.

Installing MariaDB Database Server

Now that MySQL is removed from Ubuntu, run the commands below to install MariaDB. The commands above should install the stable version of the MariaDB database server from Ubuntu repositories. During the installation, you may get the message below that the old data directory location will be saved at the new location. Accept and continue. However, if you need to install the latest versions of MariaDB, run the commands below to add the MariaDB repository key to Ubuntu. Then, run the commands below to add the MariaDB version 10.1 branch or repository to Ubuntu. Finally, run the commands below to install MariaDB from the 10.1 branches. If you want to install the latest unreleased 10.2 version, add the repository below. Then run the commands below to update to the latest 10.2 version. After installing, the commands below can be used to stop, start and enable the MariaDB service to always start up when the server boots. After that, run the commands below to secure the MariaDB server. When prompted, answer the questions below by following the guide.

Enter current password for root (enter for none): Just press the Enter Set root password? [Y/n]: Y New password: Enter password Re-enter new password: Repeat password Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]:  Y Reload privilege tables now? [Y/n]:  Y

That’s it! Now you can log in to MySQL by typing the commands below: Summary: Again, this post shows you how to convert from MySQL to a MariaDB database server. Since almost all Linux distributions are now switching from MySQL to MariaDB, it’s probably the best thing to switch as well for better system support. If you’re currently running MySQL on your server, follow the steps above to switch to MariaDB. You may also like the post below: