Server Setup

In-Place Upgrading: Percona MySQL 5.6 to 5.7 (RedHat/CentOS 7)

by , , revisited on


We have by far the largest RPM repository with dynamic stable NGINX modules and VMODs for Varnish 4.1 and 6.0 LTS. If you want to install nginx, Varnish and lots of useful modules for them, this is your one stop repository to get all performance related software.
You have to maintain an active subscription in order to be able to use the repository!

While Percona MySQL provides a nice guide on in-place upgrading of MySQL 5.6 to 5.7, we want a scripted way instead.

So I present to you, mysql56to57.sh for CentOS / RedHat 7 systems:

#!/bin/bash

# Stop service first
systemctl stop mysqld

# See what we need to install first,
# e.g.: Percona-Server-client-57 Percona-Server-devel-57 Percona-Server-server-57 Percona-Server-shared-57
MYSQL_57_PKGS=$(yum list installed | grep --perl-regexp --only-matching "^Percona-Server-[\w-]+" | sed 's/-56$/-57/' | xargs)

# Now remove existing 5.6 packages without dependencies:
rpm -qa | grep --perl-regexp "^Percona-Server-[\w-]+-56-" | xargs rpm -e --nodeps

# Install "back" same packages with 5.7 version:
yum -y install $MYSQL_57_PKGS

# Bring back the service
systemctl start mysqld

# Fix MySQL schema changes
mysql_upgrade

Save the script somewhere and run it. This will reinstall exact same Percona packages you have, but with the version bumped up to 5.7.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.