• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Rollback RPM Upgrade of the MySQL Server

by admin

Question: How can I rollback an RPM upgrade of the MySQL Server that I don’t want to keep?

There may be a number of reasons why you need to rollback an upgrade of the server, but the last thing you want is to perform the upgrade, have it fail, and then can’t get back to a working installation again. Some may say that this is why you have backups, but the backup is designed primarily to keep the data consistent and durable over the upgrade. For older RPM installations, the traditional method was to use the –old-package option. For example:

# rpm -Uvh --old-package MySQL-Server-5.1.50.x86-64.rpm

Where the RPM specified here is the package that was running before the upgrade occurred. The –old-package option allowed the packaging system to ignore that an older version was being installed and downgraded the binaries to the earlier version.

With the newer versions of RPM packaging ( 4.4.3 or higher recommended), the option is available to perform a transactional rollback of the package upgrade. To do a rollback, you first have to make sure you perform the upgrade with the –repackage option. This will create a copy package in the /var/spool/repackage directory and enable rollback in the future, if required.

It is important that if you have multiple packages that are being upgraded such as mysql-server, mysql-client, mysql-libs, etc, that you use the –repackage option for each RPM package that you upgrade. So an example on a package upgrade.

# rpm -Uvh --repackage MySQL-Server-5.1.62.x86_64.rpm 

Preparing... ############################# [100%] 

Repackaging... 

  1:MySQL-Server-5.1.62 ############################# [100%] 

Upgrading... 

  1:MySQL-Server-5.1.62 ############################# [100%]

Assuming that after one hour you are not happy with the upgrade and require a rollback to the previous version, then do the following:

# rpm -Uvh --rollback '2 hours ago' 

Rollback packages (+1/-1) to 

Thu Jul 31 23:26:52 2003 (0x3f29ddfc): 

Preparing... ########################## 100%] 

    1:MySQL-Server-5.1.50 ########################### [ 33%]

The package will now be rolled back to the previous package and ready to run again. You only specify a point in time to roll back to rather than specifying a package. This means that all packages will be rolled back at that point, so if another package was upgraded that you want to keep at the new version, you will have to be very specific in your choice of timing for the rollback.

Filed Under: mysql

Some more articles you might also be interested in …

  1. How To Start And Stop MySQL Cluster
  2. How To Reset MySQL 8.0 Root Password On Windows
  3. MySQL Backup stuck at “Starting to lock all the tables”
  4. MySQL – How to undo (rollback) a set of SQL statements
  5. How to configure resource groups for MySQL Server running on Linux
  6. MySQL Enterprise Backup (MEB): Lock the Tables While Making the Backup?
  7. How to Backup a MySQL Cluster
  8. Configuring mysqld to log slow queries
  9. MySQL Cluster Point-In-Time Recovery (PITR)
  10. How to use mysqldump without CREATE TABLE statements

You May Also Like

Primary Sidebar

Recent Posts

  • raw: command not found
  • raw Command Examples in Linux
  • rankmirrors Command Examples in Linux
  • radeontop: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright