By default, CentOS 7 uses MariaDB 5.5. Newer versions of MariaDB are available from Software Collections. Here is the code I used on a few different servers to change the SQL database version from MariaDB 5.5 to 10.2:
# Install MariaDB 10.2. You might need to add the Software Collections repo beforehand.
yum install rh-mariadb102-mariadb-server
# Stop MariaDB 5.5
# Copy databases to MariaDB 10.2
# Set owner
# Start MariaDB 10.2
systemctl stop mariadb; cp -r /var/lib/mysql /var/opt/rh/rh-mariadb102/lib; chown -R mysql:mysql /var/opt/rh/rh-mariadb102/lib/mysql; systemctl start rh-mariadb102-mariadb
# Add MariaDB 10.2 to path
scl enable rh-mariadb102 bash
# Check that PATH is set correctly
which mysql_upgrade
# If path to mysql_upgrade is /usr/bin/, then it wasn't successfully changed. Try running:
source /opt/rh/rh-mariadb102/enable
# Upgrade the copied databases
mysql_upgrade -p[PASSWORD]
# Disable MariaDB 5.5 to start on boot
systemctl disable mariadb
# Enable MariaDB 10.2 to start on boot
systemctl enable rh-mariadb102-mariadb
# Add MariaDB 10.2 to path on boot
cp /opt/rh/rh-mariadb102/enable /etc/profile.d/rh-mariadb102.sh
Don’t forget to edit your new database configuration file, which is located at /etc/opt/rh/rh-mariadb102/my.cnf
. Your old configuration will be at /etc/my.cnf
.
Good luck!