Upgrade MariaDB Community Server from 10.4.X to 10.4.Y on CentOS 7
These instructions detail a minor release upgrade with MariaDB Community Server 10.4 on CentOS Linux 7.
A minor release upgrade is a change from an earlier release of MariaDB Community Server 10.4 to a later release in the same release series.
For example, it would be a minor release upgrade to upgrade from MariaDB Community Server to MariaDB Community Server .
Occasionally, issues can be encountered during upgrades. These issues can even potentially corrupt the database's data files, preventing you from easily reverting to the old installation. Therefore, it is generally best to perform a backup prior to upgrading. If an issue is encountered during the upgrade, you can use the backup to restore your MariaDB Server database to the old version. If the upgrade finishes without issue, then the backup can be deleted.
Take a full backup:
$ sudo mariadb-backup --backup \ --user=mariabackup_user \ --password=mariabackup_passwd \ --target-dir=/data/backup/preupgrade_backup
Confirm successful completion of the backup operation.
The backup must be prepared:
$ sudo mariadb-backup --prepare \ --target-dir=/data/backup/preupgrade_backup
Confirm successful completion of the prepare operation.
Backups should be tested before they are trusted.
Stop the MariaDB Server Process
Before the new version can be installed, we first need to stop the current MariaDB Server process.
Stop the server process using the
$ sudo systemctl stop mariadb
Install the New Version
MariaDB Corporation provides a YUM package repository for CentOS Linux 7.
Install via YUM (RHEL/CentOS)
Configure the YUM package repository.
To configure YUM package repositories:
$ sudo yum install wget $ wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup $ echo "b3d5fb3ea9791e93b64a97e8b8a5faacd6e744e9d2c1c7cc3453f0390aa76569 mariadb_repo_setup" \ | sha256sum -c - $ chmod +x mariadb_repo_setup $ sudo ./mariadb_repo_setup \ --mariadb-server-version="mariadb-10.4"
Update MariaDB Community Server and package dependencies:
$ sudo yum update "MariaDB-*" "galera*"
For platforms that use YUM or ZYpp as a package manager:
MariaDB Community Server's packages bundle several configuration files:
If your version of any of these configuration files contained any custom edits, then the package manager may save your edited version with the
.rpmsave extension during the upgrade process. If you want to continue using your version with the custom edits, then you may need to move it back. For example, to move
server.cnf back in place:
$ sudo mv /etc/my.cnf.d/server.cnf /etc/my.cnf.d/server.cnf.original $ sudo mv /etc/my.cnf.d/server.cnf.rpmsave /etc/my.cnf.d/server.cnf
Starting the Server
MariaDB Community Server includes configuration to start, stop, restart, enable/disable on boot, and check the status of the Server using the operating system default process management system.
CentOS Linux 7 uses systemd. You can manage the Server process using the
Enable during startup
Disable during startup
Upgrading the Data Directory
MariaDB Community Server 10.4 ships with the mariadb-upgrade utility which can be used to identify and correct compatibility issues in the new version. After you upgrade your Server and start the server process, run this utility to upgrade the data directory:
$ sudo mariadb-upgrade
When MariaDB Community Server is up and running on your system, you should test that it is working and there weren't any issues during startup.
Connect to the server using MariaDB Client using the
$ sudo mariadb Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 Server version: 10.4.19-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
The version of the server can be verified by checking the client's initial output.
SHOW GLOBAL VARIABLES LIKE 'version';
+---------------+-----------------+ | Variable_name | Value | +---------------+-----------------+ | version | 10.4.19-MariaDB | +---------------+-----------------+
You can also verify the server version by calling the VERSION() function:
+-----------------+ | VERSION() | +-----------------+ | 10.4.19-MariaDB | +-----------------+