fbpx

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 NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

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