About Parker Services Clients Software and Publications Blog
Contact
PHM Sciences

Upgrading from MariaDB 10.2 to MariaDB 10.3 on CentOS 7

Just updated MariaDB from 10.2 to 10.3 on multiple servers using Red Hat’s Software Collections (https://www.softwarecollections.org/en/). Used the following commands. Might be of use to someone, good luck!

# Install MariaDB 10.3
yum install rh-mariadb103-mariadb-server
yum install rh-mariadb103-mariadb-server-utils

# Add MariaDB 10.3 to $PATH
scl enable rh-mariadb103 bash
source /opt/rh/rh-mariadb103/enable

# Stop 10.2 server, copy database, set permissions, start 10.3 server
systemctl stop rh-mariadb102-mariadb.service;
cp -r /var/opt/rh/rh-mariadb102/lib/mysql /var/opt/rh/rh-mariadb103/lib;
chown -R mysql:mysql /var/opt/rh/rh-mariadb103/lib/mysql;
systemctl start rh-mariadb103-mariadb

# Upgrade tables
mysql_upgrade -p[PASSWORD]

# Set 10.3 to start on boot, disable 10.2
systemctl disable rh-mariadb102-mariadb
systemctl enable rh-mariadb103-mariadb

# Add 10.3 to paths on reboot (and remove 10.2) 
rm /etc/profile.d/rh-mariadb102.sh
cp /opt/rh/rh-mariadb103/enable /etc/profile.d/rh-mariadb103.sh

Don’t forget to edit your new database configuration file, which is located at /etc/opt/rh/rh-mariadb103/my.cnf. Your old configuration will be at /etc/opt/rh/rh-mariadb102/my.cnf. The /my.cnf.d/ subdirectory at the same location may contain additional configuration files.

Leave a Reply