Tag: upgrade mysql

  • Upgrade MariaDB 5.5 to 10.1 on CentOS 7 Plesk Server

    EDIT 2022-05: Now Plesk has an easy MySQL upgrade script, to do the upgrade, run

    wget https://support.plesk.com/hc/en-us/article_attachments/4584125667858/c7-mariadb-10.5-upgrade.sh && chmod +x c7-mariadb-10.5-upgrade.sh
    ./c7-mariadb-10.5-upgrade.sh
    

    For more information, see

    https://support.plesk.com/hc/en-us/articles/12388091703703

    CentOS 7 Plesk Server come with MariaDB 5.5

    [root@224 ~]# mysql --version
    mysql  Ver 15.1 Distrib 5.5.60-MariaDB, for Linux (x86_64) using readline 5.1
    [root@224 ~]# 
    

    The rpm packages installed where

    [root@224 ~]# rpm -qa | grep -i maria
    mariadb-libs-5.5.60-1.el7_5.x86_64
    sw-mariadb-client-1.0.0-centos7.17031417.x86_64
    mariadb-server-5.5.60-1.el7_5.x86_64
    mariadb-5.5.60-1.el7_5.x86_64
    [root@224 ~]# 
    

    To upgrade MariaDB, first take a backup of all databases.

    mysqldump -u admin -p`cat /etc/psa/.psa.shadow` --all-databases --routines --triggers > /root/all-databases.sql
    
    

    Stop MariaDB databases

    service mariadb stop
    

    Make another backup of data files

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

    Create file

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

    Add following content

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

    Now run

    yum install MariaDB-client MariaDB-server
    

    This will upgrade your MariaDB 5.5 to MariaDB 10.1

    Start MariaDB

    service mariadb start
    

    At this point, you have newer MariaDB 10.1

    [root@224 ~]# mysql --version
    mysql  Ver 15.1 Distrib 10.1.36-MariaDB, for Linux (x86_64) using readline 5.1
    [root@224 ~]# 
    

    You need to upgrade databases, for this, run

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

    Restart MariaDB

    service mariadb restart
    

    update the package version inside Plesk

    plesk sbin packagemng -sdf
    

    Remove old MySQL symlink

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

    Back to Plesk