Upgrade MariaDB from 10.0 to 10.3 on Ubuntu 16.4

 

MariaDB Server is one of the most popular database servers in the World and it’s made by the original developers of MySQL and guaranteed to stay open source. In this tutorial, we will show how to upgrade MariaDB from 10.0 to 10.3 on Ubuntu 16.4. The first part is you have to verify that is safe to jump from one version to another. Based on the official MariaDB document (depends on the databases data structure) it’s not recommended to jump from one version to another version. So you should make sure all databases are in the server are compatible with MariaDB 10.3.

This is the official documents to upgrading MariaDB https://mariadb.com/kb/en/library/upgrading/

The official documents show upgrades in sequential order as this is the preferred method of upgrading.

Here are the steps to upgrade MariaDB from 10.0 to 10.3

 

Upgrading repo on Ubuntu 16.04

You will need to add required repository source to /etc/apt/sources.list on the Ubuntu 16.04. You can find trusted download source from here https://downloads.mariadb.org/mariadb/repositories/#version=10.3

You may refer the following document to enable a repo in /etc/apt/sources.list

https://wiki.debian.org/SourcesList

Once you added the source in /etc/apt/sources.list add repo on the server. Here is the example to enable a repo.

sudo add-apt-repository ‘deb [arch=amd64,arm64,i386] http://ftp.osuosl.org/pub/mariadb/repo/10.1/ubuntu_xenlan_main’

You have to uncomment the newly added source line from the sources.list file.

 

Set innodb_fast_shutdown to 0

logged in to the MariaDB as a root user then run the following command.

–innodb-fast-shutdown = 0;

 

Shut down current MariaDB 10.0

To stop MariaDB service run the following command.

service mysql stop

 

Take a current backup.

You can take backup by using cp or rsync command.

cp command:

cp -r -p /var/lib/mysql backup_name

example:

cp -r -p /var/lib/mysql mysql-backup

rsync command:

rsync -avHP /var/lib/mysql /backup_path/name

example:

rsync -avHP /var/lib/mysql  /backup/mysql-back

 

Uninstall current MariaDB 10.0

To remove MariaDB from the server, run the below command.

sudo apt remove mariadb-server-10.0

Once it has been done, install MariaDB 10.1

 

Install MariaDB 10.1

Run the following command to install MariaDB 10.1

sudo apt install mariadb-server-10.1

The next prompt you will see looks like the following screenshot.

upgrade Mariadb

 

Since we are running on Ubuntu, we will not need to execute the run mysql_upgrade command.

To verify the version, run the following command

mysql –version

Repeat all the above process until successfully installed the required version of MariaDB 10.3.

 

Leave a Reply