2.3.9 Upgrading MySQL Server on Microsoft Windows

To upgrade MySQL on Windows, follow these steps:

  1. Review Section 2.13.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:


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

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

    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.1 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. When upgrading from MySQL 5.1.23 to MySQL 5.1.24, the change in the default location of the data directory from a directory within the MySQL installation to the AppData folder means that you must manually copy the data files from your old installation to the new location.

  7. If you are using the MySQL Installation Wizard, start the wizard as described in Section, “Using the MySQL Installation Wizard for Microsoft Windows”.

  8. 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


    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

  9. 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, “Starting MySQL Server as a Microsoft Windows Service”.)

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

  11. 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.8, “mysql_upgrade — Check and Upgrade MySQL Tables”.

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