Upgrading mySQL on Windows

In my case the development environment where I wanted to upgrade mySQL was an XAMPP install from before XAMPP replaced mySQL with mariaDB but there is nothing in the process that I used that is dependent on the particular setup prior to installing the new version of mySQL. Most of the same steps should also work for other operating systems but I haven't tested this other than on Windows 10.

The first step is to backup all of your databases from your existing setup as SQL commands. You will need to reload everything to the new mySQL as there is no guarantee that anything you currently have in your database structure will continue to work correctly with the new version of mySQL if you were to simply copy the files across. Once you have done this then close the mysql service.

Next download a zip file copy of the version of mySQL to be installed and unpack it to a folder in the same location as your existing mysql folder (but with a different name). You then need to run mysql.exe to create the initial database files. Rename your existing mysql folder to something else and rename the new one in its place.

Rename the appropriate ini file in the new version of mysql to my.ini and then compare the new my.ini file with the one you were using before. I use a program called Meld to do comparisons like this as it highlights all of the specific differences for me.

You now need to work out what differences are required for the new version of mySQL to work and what ones need the information from the old my.ini copied to the new my.ini in order for it to work with your setup.

The next thing to do is to restart the mysql service. If it starts then you most likely got he my.ini file right. If it doesn't start then you need to check the error logs to find out which line or lines from the old my.ini file that you copied to the new one that you shouldn't have copied.

With the new mySQL actually running you next need to recreate the databases and users that you had on your old system. How you do this depends on what you have available for running the necessary commands but if you are upgrading within XAMPP then you can use phpMyAdmin to do the database creates and user creates that you need.

The final step is to import the database content from the backups that you ran in the first step above. Once you have done this all your applications should be working again in exactly the same way that they were with the old mySQL version.

You can easily switch back to the old version at any stage during this process simply by stopping the mysql service and renaming the two folders.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow