WF AQ

Knowledge base

Upgrade Mysql da 5.1 a 5.5 e quindi da 5.5 a 5.6/5.7 o MariaDB 5.5 to 10.0/10.1/10.2 in Plesk Linux

N.B.: l’upgrade diretto da 5.1 a 5.6/5.7 può danneggiare il sistema. Procedere quindi prima con l’upgrade da 5.1 a 5.5 e successivamente a 5.6/5.7 

Versioni supportate:

Plesk Onyx for Linux:

  • MySQL 5.1–5.7
  • MySQL community edition 5.5, 5.6, 5.7

 

How to upgrade MySQL from 5.1 to 5.5 on Plesk for Linux

Plesk Installer gets packages from base repositories of an operating system installed.

If MySQL 5.5 is not listed in the base repository, it is not available in Plesk Installer.

In that case, in order to upgrade MySQL version to 5.5, it is needed to configure a third-party repository.

Note: PHP package can also be upgraded during this procedure. Oracle MySQL yum repository is supported only by Plesk Onyx. Also, it is required to have an SSH connection to the server with administrative privileges.

For CentOS/RHEL/CloudLinux systems Atomic repository can be used:

  1. Install the Atomicorp repository:

    # wget -q -O – http://www.atomicorp.com/installers/atomic | sh

  2. Upgrade MySQL:

    # yum upgrade mysql

  3. Restart the MySQL service:

    # service mysqld restart

  4. Upgrade MySQL databases:

    # mysql_upgrade -uadmin -p`cat /etc/psa/.psa.shadow`

  5. In case the message below appears, refer to the KB article Error during yum upgrade: Packages excluded due to repository protections:

    # yum upgrade mysql
    ….
    881 packages excluded due to repository protections
    No Packages marked for Update

 

 

How to upgrade MySQL 5.5 to 5.6/5.7 or MariaDB 5.5 to 10.0/10.1/10.2 on Linux

https://support.plesk.com/hc/en-us/articles/213403429-How-to-upgrade-MySQL-5-5-to-5-6#centos7

 

For CentOS 6:

      1. Stop the MySQL service:

        # service mysqld stop

      2. Create a backup of databases:

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

      3. Disable Atomic repository, if it is enabled:

        # vi /etc/yum.repos.d/atomic.repo
        enabled = 0

      4. Install the MySQL-community repository:

        # yum install http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm

      5. Select a MySQL version:

        # vi /etc/yum.repos.d/mysql-community.repo
        [mysql56-community]
        enabled=0
        [mysql57-community]
        enabled=1

      6. Install MySQL packages:

        # yum update mysql

        If update of mysql package ends with Nothing to do message, make sure that mysql* packages are not added to excludes in yum.conf file and remove it if it is in the list:

        # cat /etc/yum.conf | grep exclude
        exclude=php-common php-cli php mysql* httpd* mod_ssl*

      7. Type y if this message appears:

        warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
        Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
        Importing GPG key 0x5072E1F5:
        Userid : MySQL Release Engineering <mysql-build@oss.oracle.com>
        Package: mysql57-community-release-el6-7.noarch (@/mysql57-community-release-el6-7.noarch)
        From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
        Is this ok [y/N]:

      8. Start the MySQL service:

        # service mysqld start

        If the service does not start, check the following article: MySQL fails to start: mysql.user table is damaged.

      9. Upgrade MySQL databases:

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

      10. Restart mysql service:

        # service mysqld restart

 

For 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

      3. Remove additional packages like mariadb-bench:

        # rpm -e mariadb-bench

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

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

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

        [mariadb]
        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

      7. Start the MariaDB service:

        # service mariadb start

      8. Upgrade MySQL databases:

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

      9. Restart mysql service:

        # service mariadb restart

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

        # plesk sbin packagemng -sdf

        Note: After an upgrade to 10.1 version, there may appear ‘mysql’ init script. It can be removed:

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