Let’s learn how to upgrade MySQL binary and package-based installations in Unix or Linux. This can be done in-place or using the logical upgrade method. Let us briefly understand these two methods -
In-place upgrade involves shutting down the old MySQL server and replacing the old MySQL binaries or packages Replace with new ones.
After completing this operation, the MySQL server will be restarted on the existing data directory.
After this, the remainder of the existing installation (that requires some kind of upgrade) will be upgraded.
For some Linux platforms, MySQL installation from RPM or Debian packages will Includes "systemd" support to help manage MySQL server startup and shutdown.
The command "mysqld_safe" will not be installed on such systems.
li>Logical upgrade involves exporting SQL from an old MySQL instance.
Existing data needs to be exported from the previous MySQL installation, this can be done using the following command -
mysqldump -u root -p --add-drop-table --routines --events --all-databases --force > data-for-upgrade.sql
Use the following command to close the old MySQL server-
mysqladmin -u root -p shutdown
Use the following command to start a new data directory-
mysqld --initialize --datadir=/path/to/8.0-datadir &
Use the following command to reset the root password-
shell> mysql -u root -p Enter password: **** <− enter temporary root password mysql> ALTER USER USER() IDENTIFIED BY 'your new password';
Use the following command to transfer the previously created directory. Load the storage file into the newly created MySQL server -
mysql -u root -p --force < data-for-upgrade.sql
MGM node upgrade.
Data node upgrade 1 is upgraded once at a time.
API nodes are upgraded one at a time, including the MySQL server.
Data dictionary upgrade.
System table upgrade.
The system restarts.
li>The above is the detailed content of Upgrading MySQL binary or package-based installation on Unix/Linux. For more information, please follow other related articles on the PHP Chinese website!