CentOS 7 is shipped with MariaDB. MariaDB 10.x version is a drop-in replacement for MySQL 5.5-5.7.
- 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
- Stop the MariaDB service:
# service mariadb stop
Note: Remove additional packages like mariadb-bench:
# rpm -e mariadb-bench
- Copy a databases directory in a separate folder like this (for backup purposes also):
# cp -a /var/lib/mysql/ /var/lib/mysql_backup
- Check if you already have mysql-server installed:
# rpm -q –whatprovides mysql-server
If it is installed and the command above gives output, it is required to be removed using the following command:
# rpm -e –nodeps `rpm -q –whatprovides mysql-server`
- Configure MariaDB repository: open the Setting MariaDB repositories page, select OS distro, release and MariaDB version to see the configuration that should be added to /etc/yum.repos.d/MariaDB.repo file. Example for MariaDB 10.1:
# vi /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck = 1 - Perform an upgrade with:
# yum install MariaDB-client MariaDB-server
- Start the MariaDB service:
# service mariadb start
OR
# service mysql start
- Upgrade MySQL databases:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin
- Restart mysql service:
# service mariadb restart
OR
# service mysql restart