2.19.1 Upgrading MySQL

2.19.1.1 Changes Affecting Upgrades to 5.0

This section describes how to upgrade to a new MySQL version.

Supported Upgrade Methods

For in-place and logical upgrade procedures, see Performing an In-place Upgrade, and Performing a Logical Upgrade.

If you run MySQL Server on Windows, see Section 2.10.7, “Upgrading MySQL on Windows”.

Supported Upgrade Paths

Unless otherwise documented, the following upgrade paths are supported:

The following conditions apply to all upgrade paths:

Before You Begin

Before upgrading, review the following information and perform the recommended steps:

Performing an In-place Upgrade

This section describes how to perform an in-place upgrade. Review Before you Begin before proceeding.

Note

If you upgrade an installation originally produced by installing multiple RPM packages, upgrade all the packages, not just some. For example, if you previously installed the server and client RPMs, do not upgrade just the server RPM.

To perform an in-place upgrade:

  1. Review the changes described in Section 2.19.1.1, “Changes Affecting Upgrades to 5.0” for steps to be performed before upgrading.

  2. If you use InnoDB, configure MySQL to perform a slow shutdown. For example:

    shell> bin/mysql -u root -ppassword --execute="set global innodb_fast_shutdown=0"

    With a slow shutdown, InnoDB performs a full purge and change buffer merge before shutting down, which ensures that data files are fully prepared in case of file format differences between releases.

  3. Stop the old MySQL server.

  4. Upgrade the MySQL binaries or packages in place (replace the 4.1 binaries with those from 5.0).

  5. Start the MySQL 5.0 server using the existing data directory.

  6. Run mysql_upgrade. For example:

    shell> bin/mysql_upgrade -u root -ppassword

    mysql_upgrade examines all tables in all databases for incompatibilities with the current version of MySQL Server. mysql_upgrade also upgrades the system tables so that you can take advantage of new privileges or capabilities.

    Note

    mysql_upgrade does not upgrade the contents of the help tables. For upgrade instructions, see Section 5.1.8, “Server-Side Help”.

Performing a Logical Upgrade

This section describes how to perform a logical upgrade. Review Before you Begin before proceeding.

To perform a logical upgrade:

  1. Review the changes described in Section 2.19.1.1, “Changes Affecting Upgrades to 5.0” for steps to be performed before upgrading.

  2. Export your existing data from the previous MySQL version:

    shell> mysqldump --add-drop-table --add-drop-table
        -> --all-databases --force > data-for-upgrade.sql
    
    Note

    The --all-databases option includes all databases in the dump, including the mysql database that holds the system tables.

  3. Stop the old MySQL server.

  4. Install MySQL 5.0.

  5. Initialize a new data directory:

    shell> scripts/mysql_install_db --user=mysql --datadir=/path/to/5.0-datadir
    
  6. Start the MySQL 5.0 server using the new data directory.

  7. Load the previously created dump file into the new MySQL server. For example:

    shell> bin/mysql -u root -ppassword --execute="source data-for-upgrade.sql" --force
  8. Run mysql_upgrade. For example:

    shell> bin/mysql_upgrade -u root -ppassword

    mysql_upgrade examines all tables in all databases for incompatibilities with the current version of MySQL Server. mysql_upgrade also upgrades the system tables so that you can take advantage of new privileges or capabilities.

    Note

    mysql_upgrade does not upgrade the contents of the help tables. For upgrade instructions, see Section 5.1.8, “Server-Side Help”.

  9. If you use InnoDB, configure MySQL to perform a slow shutdown. For example:

    shell> bin/mysql -u root -ppassword --execute="set global innodb_fast_shutdown=0"
  10. Shut down and restart the MySQL server to ensure a clean shutdown and startup.

Upgrade Troubleshooting