Table of Contents
It has been a while since MariaDB 10.3 has been out, bringing its stunning pack of changes, improvements and new features – most notably, System-versioned tables and Sequences. If you found this post on Google, there’s a high chance you want to upgrade your previous version of MariaDB and take advantage of these awesome new feats.
In this article, we’ll see how we can safely update any existing 10.0, 10.1 or 10.2 MariaDB instance with the new MariaDB 10.3 – more specifically, MariaDB 10.3.13-GA, which has been released on 2018-07-03 and is the latest stable version as of today. The steps below have been tested on a Linux CentOS 7 machine, but can be used – or slightly adapted by replacing yum with apt-get – with most Linux distributions.
#1: Perform a full backup
The first thing to do is to perform a full backup of the whole MariaDB server instance. To do so, I strongly suggest you to read this MySQL/MariaDB backup tutorial using the free mysqldump command-line tool. In very short words, here’s the one-liner:
# mysqldump -u db_root_user -p -x -A > /bak/db_backup.sql
If everything goes well, you won’t need this backup: however, since we’re performing a DB upgrade here, it’s better to be safe than sorry.
#2: Shutdown the existing MariaDB service
The next thing to do is to shutdown the existing MariaDB server. This can be done with the following command:
# sudo systemctl stop mariadb
#3: Uninstall the old MariaDB version
This step might sound scary, but don’t worry: your existing databases and your current my.cnf file won’t be deleted, only the binaries will.
# sudo yum remove mariadb mariadb-server
#4: Configure the MariaDB 10.3 repository
As soon as the previous MariaDB instance is gone, we need to install the new version: in order to do that, we need to tell our Linux machine where to find the updated binaries. If you’re using CentOS, RHEL or another yum-based distribution, you can easily do that by creating a new MariaDB10.repo file to the /etc/yum.repos.d/ folder and filling it with the following content:
# MariaDB 10.3 CentOS repository list
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
In case you already have a MariaDB.repo, MariaDB10.repo or some other .repo file pointing to the old binaries, you might as well update it with the new 10.3 URIs.
#5: Install the new MariaDB 10.3 build
Now that yum will find the new binaries, we can proceed installing the new MariaDB server with the following command:
# sudo yum install mariadb mariadb-server
This will install both the client and the server.
#6: Start and Enable the new MariaDB service
Once the installation job is complete, you can restart and enable the new MariaDB server with the following commands:
# sudo systemctl start mariadb
# sudo systemctl enable mariadb
#7: Upgrade your existing database(s)
Last but not least, you need to run the mysql_upgrade command to upgrade the permission tables in the mysql database with some new fields:
# sudo mysql_upgrade
This command will also perform a very quick check of all tables and marks them as compatible with MariaDB 10.3.
That’s about it: I sincerely hope that this small tutorial will help you upgrading to MariaDB 10.3 and enjoy its new exciting features!