Upgrading MySQL

Supported Upgrade Methods

In-place upgrade

Involves shutting down the old MySQL version, replacing the old MySQL binaries or packages with the new ones, restarting MySQL on the existing data directory, and running mysql_upgrade.

Logical Upgrade

Involves exporting existing data from the old MySQL version using mysqldump, installing the new MySQL version, loading the dump file into the new MySQL version, and running mysql_upgrade

Performing an In-place Upgrade

Backup the databases before you begin and read the upgrade notes for the specific version.

  1. Configure MySQL to perform a slow shutdown by setting innodb_fast_shutdown to 0. shell> bin/mysql -u root -p password --execute="set global innodb_fast_shutdown=0"

  2. Shut down the old MySQL server shell> bin/mysqladmin -u root -p password shutdown

  3. Upgrade the MySQL binaries or packages in place, replacing the old binaries or packages with the new ones.

  4. Start the MySQL server, using the existing data directory.

  5. Run mysql_upgrade.

Performing a Logical Upgrade

  1. Export your existing data from the previous MySQL version: shell> mysqldump --add-drop-table --routines --events -> --all-databases --force > data-for-upgrade.sql

  2. Shut down the old MySQL server shell> bin/mysqladmin -u root -p password shutdown

  3. Install MySQL 5.7.

  4. Initialize a new data directory shell> mysqld --initialize --datadir=/path/to/5.7-datadir Copy the temporary 'root'@'localhost' password printed to your screen or written to your error log for later use.

  5. Start the MySQL 5.7 server, using the new data directory. shell> bin/mysqld_safe --user=mysql --datadir=/path/to/5.7-datadir

  6. Reset the root password shell> mysql -u root -p Enter password:**<- enter temporary root password

    mysql> ALTER USER USER() IDENTIFIED BY 'your new password';

  7. Load the previously created dump file into the new MySQL server. shell> bin/mysql -u root -p password --execute="source data-for-upgrade.sql" --force

  8. Run mysql_upgrade. shell> bin/mysql_upgrade -u root -p password

  9. Configure MySQL to perform a slow shutdown by setting innodb_fast_shutdown to 0. shell> bin/mysql -u root -p password --execute="set global innodb_fast_shutdown=0"

  10. Shut down and restart the MySQL server to ensure a clean shutdown and startup. shell> bin/mysqladmin -u root -p password shutdown shell> bin/mysqld_safe --user=mysql --datadir=/path/to/5.7-datadir

results matching ""

    No results matching ""