How to upgrade MariaDB 5.5 to 10.0/10.1/10.2 on Centos 7

 

This article provides instructions for upgrading  MariaDB 5.5 to 10.0/10.1/10.2 on Linux.

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

  1. For security reasons, create a database dump 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 MariaDB:

    # service mariadb stop

  3. Remove additional packages like mariadb-bench:

    # rpm -e --nodeps mariadb-bench

  4. For security reasons, copy the database directory in a separate folder:

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

  5. Check if the mysql-server package is already installed:

    # rpm -q --whatprovides mysql-server

    If it is installed and the command above gives output, remove using the following command:

    # rpm -e --nodeps `rpm -q --whatprovides mysql-server`

  6. Configure MariaDB repository: open the Setting MariaDB repositories page, select your OS distro, release and a desired MariaDB version. Once done, the configuration that should be added to the /etc/yum.repos.d/MariaDB.repo file will appear.

    Here is an example for MariaDB 10.2:

    6.1. Open/create the MariaDB.repo file in any text editor. In this example, we are using the vi editor:

    # vi /etc/yum.repos.d/MariaDB.repo

    6.2. Add the content below to the file:

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

    6.3. Save the changes and close the file.

  7. Start an upgrade of MariaDB:

    # yum install MariaDB-client MariaDB-server

  8. Once the upgrade is finished, start MariaDB:

    # service mariadb start

    OR

    # service mysql start

  9. Upgrade MySQL databases:

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

  10. Restart mysql service:

    # service mariadb restart

    OR

    # service mysql restart

  11. Execute this command to update the package version inside Plesk:

    # plesk sbin packagemng -sdf

    Note: After an upgrade to 10.2 version, there may appear 'mysql' init script. It can be removed.

    # rm /etc/init.d/mysql
    # systemctl daemon-reload

  • plesk, MariaDB
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Connecting using PuTTY on Windows workstations

Configuring PuTTY In PuTTY, under Session, enter your Host Name Under Connection choose Data...

How to install the php-mcrypt module on a Plesk server

Question How to install the php-mcrypt module on a Plesk server? Answer Notes: The solution in...

Windows: Accessing Your Server with Remote Desktop

This article explains how to use Remote Desktop to access your Windows server’s desktop from...

What is Reverse DNS?

Reverse DNS (rDNS) is name resolution that looks up an IP addresses to obtain a domain name,...

What is Reverse DNS?

Reverse DNS (rDNS) is name resolution that looks up an IP addresses to obtain a domain name,...