2.3.7 Upgrading MySQL on Windows

To upgrade MySQL on Windows, follow these steps:

  1. Review Section 2.10.1, “Upgrading MySQL”, for additional information on upgrading MySQL that is not specific to Windows.

  2. Always back up your current MySQL installation before performing an upgrade. See Section 7.2, “Database Backup Methods”.

  3. Download the latest Windows distribution of MySQL from http://dev.mysql.com/downloads/.

  4. Before upgrading MySQL, stop the server. If the server is installed as a service, stop the service with the following command from the command prompt:

    C:\> NET STOP MySQL
    

    If you are not running the MySQL server as a service, use mysqladmin to stop it. For example, before upgrading from MySQL 5.5 to 5.6, use mysqladmin from MySQL 5.5 as follows:

    C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqladmin" -u root shutdown
    
    Note

    If the MySQL root user account has a password, invoke mysqladmin with the -p option and enter the password when prompted.

  5. Before upgrading to MySQL 5.6 from a version previous to 4.1.5, or from a version of MySQL installed from a Zip archive to a version of MySQL installed with the MySQL Installation Wizard, you must first manually remove the previous installation and MySQL service (if the server is installed as a service).

    To remove the MySQL service, use the following command:

    C:\> C:\mysql\bin\mysqld --remove
    

    If you do not remove the existing service, the MySQL Installation Wizard may fail to properly install the new MySQL service.

  6. If you are using the MySQL Installer, start it as described in Section 2.3.3, “Installing MySQL on Microsoft Windows Using MySQL Installer”.

  7. If you are upgrading MySQL from a Zip archive, extract the archive. You may either overwrite your existing MySQL installation (usually located at C:\mysql), or install it into a different directory, such as C:\mysql5. Overwriting the existing installation is recommended. However, for upgrades (as opposed to installing for the first time), you must remove the data directory from your existing MySQL installation to avoid replacing your current data files. To do so, follow these steps:

    1. Unzip the Zip archive in some location other than your current MySQL installation

    2. Remove the data directory

    3. Rezip the Zip archive

    4. Unzip the modified Zip archive on top of your existing installation

    Alternatively:

    1. Unzip the Zip archive in some location other than your current MySQL installation

    2. Remove the data directory

    3. Move the data directory from the current MySQL installation to the location of the just-removed data directory

    4. Remove the current MySQL installation

    5. Move the unzipped installation to the location of the just-removed installation

  8. If you were running MySQL as a Windows service and you had to remove the service earlier in this procedure, reinstall the service. (See Section 2.3.5.7, “Starting MySQL as a Windows Service”.)

  9. Restart the server. For example, use NET START MySQL if you run MySQL as a service, or invoke mysqld directly otherwise.

  10. As Administrator, run mysql_upgrade to check your tables, attempt to repair them if necessary, and update your grant tables if they have changed so that you can take advantage of any new capabilities. See Section 4.4.7, “mysql_upgrade — Check and Upgrade MySQL Tables”.

  11. If you encounter errors, see Section 2.3.6, “Troubleshooting a Microsoft Windows MySQL Server Installation”.