Site icon GetPageSpeed

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

Percona MySQL Server

Percona MySQL Server

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/RHEL 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.

Exit mobile version