Knowledge Base

How Can We Help?

How to upgrade MariaDB from version 10.0 to 10.3 on Ubuntu 16.4

You are here:

MariaDB Server is a popular database server, developed by the original MySQL developers and committed to remaining open source. This tutorial will demonstrate the process of upgrading MariaDB from 10.0 to 10.3 on Ubuntu 16.4. Before proceeding, it is essential to ensure the compatibility of all databases on the server with MariaDB 10.3, as recommended by the official MariaDB documentation (based on the structure of the databases).

The official documentation for the upgrade process can be found at: https://mariadb.com/kb/en/library/upgrading/

The official documents suggest following the sequential order of upgrades, as it is the preferred method.

Below are the necessary steps to upgrade MariaDB from 10.0 to 10.3:

Updating the repository on Ubuntu 16.04

To enable the required repository source for Ubuntu 16.04, add it to the /etc/apt/sources.list file. A trusted download source can be found at: https://downloads.mariadb.org/mariadb/repositories/#version=10.3

For instructions on enabling a repository in /etc/apt/sources.list, refer to the following document: https://wiki.debian.org/SourcesList

Once the source is added to /etc/apt/sources.list, enable the repository on the server. Here is an example of how to enable a repository:

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

Uncomment the newly added source line in the sources.list file.

Setting innodb_fast_shutdown to 0

After logging into MariaDB as the root user, execute the following command:

–innodb-fast-shutdown = 0;

Shutting down the current MariaDB 10.0

To stop the MariaDB service, use the following command:

service mysql stop

Backing up the current data

You can take a backup using the cp or rsync command.

Using cp command:

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

Example:

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

Using rsync command:

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

Example:

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

Uninstalling the current MariaDB 10.0

To remove MariaDB from the server, run the following command:

sudo apt remove mariadb-server-10.0

Once done, proceed with installing MariaDB 10.1

Installing MariaDB 10.1

Execute the following command to install MariaDB 10.1:

sudo apt install mariadb-server-10.1

The next prompt will appear as shown in the following screenshot:

Upgrade Mariadb

Since Ubuntu is being used, there is no need to execute the mysql_upgrade command.

To confirm the version, run the following command:

mysql –version

Repeat the entire process until the required version of MariaDB 10.3 is successfully installed.

Leave a Comment