Question
How to upgrade MariaDB 10.0 to 10.1 on CentOS 7?
Answer
- Connect to the server via SSH
-
Create a backup of all databases with the following command:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin –all-databases –routines –triggers > /tmp/all-databases.sql
- Copy a databases directory in a separate folder like this (for backup purposes as well):
# cp -a /var/lib/mysql/ /var/lib/mysql_backup
-
Configure the repository. Create or modify the
/etc/yum.repos.d/MariaDB.repo
file as follows:[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck = 1 -
Update the MariaDB packages (the main package will not be updated):
# yum update
-
Remove the old MariaDB package without its dependencies:
# rpm -e –nodeps MariaDB-server
-
Install MariaDB-server package v.10.1:
# yum install MariaDB-server
…
Warning: RPMDB altered outside of yum.
** Found 1 pre-existing rpmdb problem(s), ‘yum check’ output follows:
plesk-mysql-server-17.8.11-cos7.build1708180301.19.x86_64 has missing requires of mariadb-server >= (‘0’, ‘5.0.60’, None)
Installing : MariaDB-server-10.1.34-1.el7.centos.x86_64 1/1
Verifying : MariaDB-server-10.1.34-1.el7.centos.x86_64 1/1
Installed:
MariaDB-server.x86_64 0:10.1.34-1.el7.centos -
Start the MariaDB service:
# service mariadb start
-
Upgrade MySQL databases:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin
-
Restart mysql service:
# service mariadb restart
-
Execute this command to update the package version inside Plesk:
# plesk sbin packagemng -sdf
Note: There may appear a ‘mysql’ init script. Remove it and reload the systemctl daemon:
# rm /etc/init.d/mysql
# systemctl daemon-reload -
Eventually, check the installed MariaDB version. For example, like this:
# service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service – MariaDB 10.1.34 database server
…
Additional information
How to upgrade MySQL 5.5 to 5.6/5.7 or MariaDB 5.5 to 10.0/10.1/10.2 on Linux