Switch from MySQL to MariaDB 10.2 Database on Ubuntu 16.04 LTS Server

If you’re currently running MySQL database server on Ubuntu 16.04 and you wish to switch to MariaDB, the steps be can be a good starting point…

This post is intended to help students and new users convert from MySQL to MariaDB database server on Ubuntu 16.04 LTS.

As you may already know, MariaDB is rapidly gaining tractions on Linux systems, including Ubuntu. Over the past years, it was MySQL which was the default database server… now MariaDB has taken over.

After Oracle Corporation purchased the previous MySQL parent 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 uninstall MySQL and install MariaDB, applications that depended on MySQL won’t know the difference after installing MariaDB.

Step 2: Installing MariaDB Database Server

Now that MySQL is removed from Ubuntu, run the commands below to install MariaDB.

sudo apt-get install mariadb-server mariadb-client libmariadbclient18

The commands above should install the stable version of 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 new location.. Accept and continue.

┌────────────────────┤ Configuring mariadb-server-10.1 ├──────
│ The old data directory will be saved at new location
│ A file named /var/lib/mysql/debian-*.flag exists on this system. The
│ number indicates a database binary format version that cannot
│ automatically be upgraded (or downgraded).
│ Therefore the previous data directory will be renamed to
│ /var/lib/mysql-* and a new data directory will be initialized at
│ /var/lib/mysql.
│ Please manually export/import your data (e.g. with mysqldump) if needed.
│ <Ok>
│
└────────────────────────────────────────────────────────

However, if you need to install the latest versions or MariaDB, run the commands below to add MariaDB repository key to Ubuntu.

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 login to MySQL by typing the commands below:

sudo mysql -u root -p

Summary:

Again, this post shows you how to convert from MySQL to 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.

This article is so misleading, I can’t believe it. As previously mentioned, this will NOT migrate your existing database. This is completely useless. It simply removes mysql and installs mariadb, completely ignoring what’s going to happen to the database itself.