upgrade MariaDB 5.5->10.3 CentOS 7

CentOS 7 is shipped with MariaDB. MariaDB 10.x version is a drop-in replacement for MySQL 5.5-5.7.

  1. 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

  2. Stop the MariaDB service:

    # service mariadb stop

    Note: Remove additional packages like mariadb-bench:

    # rpm -e mariadb-bench

  3. Copy a databases directory in a separate folder like this (for backup purposes also):

    # cp -a /var/lib/mysql/ /var/lib/mysql_backup

  4. 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`

  5. 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

    name = MariaDB
    baseurl = http://yum.mariadb.org/10.1/centos7-amd64
    gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck = 1

  6. Perform an upgrade with:

    # yum install MariaDB-client MariaDB-server

  7. Start the MariaDB service:

    # service mariadb start


    # service mysql start

  8. Upgrade MySQL databases:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin

  9. Restart mysql service:

    # service mariadb restart


    # service mysql restart

Posted in Uncategorized.