#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 > /backup/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 # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.3/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
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!
- how to Upgrade MariaDB 10.1 to 10.5 on Debian Stretch
- How to replace MySQL with Percona Server on Debian or Ubuntu
- How to upgrade Debian 8 Jessie to Debian 9 Strech
- how to export mysql database from docker container
- How to install phpMyAdmin with nginx on Debian 11