Completely uninstall MySQL from Windows
Some time ago I was running a few tests in my lab environment against a current version of MySQL. A few months later I needed to access it again but I forgot my root password so I wanted to start from scratch. Easy enough, right? Just go to Add/Remove programs in the Control Panel and uninstall MySQL.
Not so quick. That didn’t work as expected. While it uninstalled MySQL, it wouldn’t let me reinstall MySQL because the root password was not correct. After doing some research I found that MySQL doesn’t do a complete uninstall when it is removed. As expected, the data files remain. However, some configuration information also remains, including the root user and the password used for previous installations.
After you have uninstalled MySQL through Add/Remove programs, you now need to remove the existing database information which includes your actual data. If you need any of that data, be sure to back it up. Next you can delete the data directory.
For MySQL 5.1 and earlier on Windows XP and Windows 2003, it will be located in the MySQL installation directory so remove those folders. If you are running later versions of MySQL it should be located in C:\Documents and Settings\All Users\Application Data\MySQL if you used the default settings during installation. If you are running Windows 7 or Windows Server 2008 or later, the default data directory is C:\ProgramData\MySQL.
Once you have removed the appropriate data directory, you should be all set to install MySQL from scratch.
Rick is a Senior Support Lead at OrcsWeb, a hosted server company providing managed hosting solutions.