mysqlmysqlupgrade

MySQL - Upgrade from 5.7 to 8.0 in Windows


I'm trying to update MySQL Server from 5.7 to 8.0. I already know that the only way is using the Windows ZIP Distribution, but my question is: for subsequent updates, do I have to use the zip file method or it is also possible to use the most recent installer on Mysql website?

I've upgraded MySQL using zip file from version 5.7.26 to 8.0.16. When I try to launch the installer for a subsequent version it shows that the MySQL installed version is still 5.7.26. (As you can see in the image the other products are upgraded to 8.0.16)

The data_dir is C:\ProgramData\MySQL\MySQL Server 5.7\Data and the binaries are in the default location - C:\Program Files\MySQL\MySQL Server 5.7\bin

enter image description here


Solution

  • Be sure to take a full backup before making any changes!

    As administrator:

    1. Stop the existing MySQL service and disable automatic startup.
    2. Copy "C:\ProgramData\MySQL\MySQL Server 5.7\Data" to "C:\ProgramData\MySQL\MySQL Server 8.0\Data"
    3. Copy your existing ini file from "C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" to "C:\ProgramData\MySQL\MySQL Server 8.0\my.ini".
    4. Update data_dir in the new my.ini file
    5. Do a clean install of MySQL 8.0 using the installer and the default locations. It "should" pick up and upgrade the copied data dir to 8.0.32.

    I haven't done this for a very long time, but it should work. Then you can use the installer to maintain your MySQL 8.0 version.