Last Updated on 2014-07-10.
Scenario
You run a Windows server with MySQL DB, want to keep it up to date, keep all settings and the upgrade process should work as fast as possible.
Unfortunately, the official MySQL upgrading guides are too detailed in most cases, however they don’t really explain clear how to do e.g. a simple upgrade from 5.1 or 5.5. to 5.6 and keep your data and settings.
Steps for upgrading
- Stop the MySQL service (and other services which need the DBs, if necessary).
- Uninstall MySQL (Windows search -> programs and features). The data stays in c:programdata.
- Download and install the current version of MySQL. At the moment this is 5.6.19, but this guide should work for earlier and later versions. Use “add / install features/products” option, the update option does not work if the “version jump” is too large.
- Don’t run the Instance Config after installation (close the wizard). It only works well for new installations. As you want to keep your settings, you do not want to have a new my.ini etc. to be written.
- Copy c:program filesmysqlMySQL Server xxmy.ini to the new installation directory.
- Open my.ini in the new directory and modify the 2 absolute paths (e.g. change “5.5” to “5.6” in the program and data path line).
- Copy c:programdatamysqlMySQL Server xxdata to the new data directory.
- (Optional) Modify the runtime environment path with the System variables Windows dialog.
- Install MySQL Windows service by opening command line and enter “[your-path-to-mysql-bin]mysqld -install MySQL”
- Run the service.
- If it cannot get started, have a look at the Windows event log “Application”. You might have to modify or remove some definitions of your my.ini. Then try again to start the service.
- To be safe, run [your-path-to-mysql-bin]mysql_upgrade
- You are done. Test if everything works, then delete several folders of your old MySQL installation.
Note
I recommend the above steps e.g. for home users who use it with non-critical data like MediaCenter data (MediaPortal, XBMC etc.) where the upgrade process should be done within minutes. If you are in a production environment, of course you have to be more careful and in this case the official MySQL tutorials are right for you.
In addition, I assume you use the default paths.