Upgrading MySQL Binary or Package-based Installations on Unix/Linux

MySQLMySQLi Database

Let us understand how MySQL binary and package-based installations can be upgraded in Unix or Linux. This can be done in-place as well as by using a logical upgrade method. Let us understand both these methods in brief −

In place upgrade

  • An in−place upgrade involves shutting down the old MySQL server, replacing the old MySQL binaries or the packages with the new ones.

  • Once this is done, the MySQL server is restarted on the existing data directory.

  • After this, the remaining parts of the existing installation, that require some kind of upgrade, are upgraded.

  • For some Linux platforms, MySQL installation from RPM or Debian packages will include ‘systemd’ support that helps manage MySQL server startup and shut down.

  • The command ‘mysqld_safe’ wouldn’t have been installed on such systems.

Logical Upgrade

  • A logical upgrade involves exporting the SQL from old MySQL instance.

  • The existing data needs to be exported from the previous MySQL installation, which can be done using the below command -

mysqldump -u root -p
--add-drop-table --routines --events
--all-databases --force > data-for-upgrade.sql

The old MySQL server is shut down using the below command −

mysqladmin -u root -p shutdown

A new data directory is initiated using the below command −

mysqld --initialize --datadir=/path/to/8.0-datadir &

Reset the root password using the below command −

shell> mysql -u root -p
Enter password: **** <− enter temporary root password
mysql> ALTER USER USER() IDENTIFIED BY 'your new password';

Load the previously created dump file into the newly created MySQL server using the below command −

mysql -u root -p --force < data-for-upgrade.sql

MySQL Cluster Upgrade

  • The MGM nodes are upgraded.

  • The data nodes are upgraded one at a time.

  • The API nodes are upgraded one at a time, and this includes the MySQL servers.

  • The data dictionary is upgraded.

  • The system tables are upgraded.

  • The system is restarted.

raja
Published on 08-Mar-2021 12:08:07
Advertisements