How to Completely Uninstall MySQL on Windows
This guide provides step-by-step instructions for removing MySQL Server and all associated components from your Windows system.
Prerequisites
Before beginning the uninstall process, ensure you have:
- Administrative privileges on your Windows system
- Backed up any important databases or configuration files you wish to retain
Step 1: Stop and Remove the MySQL Service
First, you need to stop the MySQL service and remove it from Windows services.
- Open Command Prompt as Administrator by right-clicking the Start button and selecting "Command Prompt (Admin)" or "Windows PowerShell (Admin)".
- Execute the following commands:
net stop MySQL
sc delete MySQL
Note: If your MySQL service has a different name (such as MySQL80 or MySQL57), replace "MySQL" in the commands above with the actual service name.
Step 2: Uninstall MySQL Through Control Panel
Remove the MySQL application using the Windows uninstaller.
- Open Control Panel and navigate to Programs and Features (or Add or Remove Programs).
- Locate MySQL or MySQL Server in the list of installed programs.
- Right-click on the entry and select Uninstall, then follow the prompts to complete the uninstallation.
Step 3: Delete MySQL Data Directories
Remove all remaining MySQL files and folders from your system.
First, ensure hidden files and folders are visible:
- Open File Explorer, click the View tab, and check Hidden items.
Then delete the following directories if they exist:
- C:\Program Files\MySQL
- C:\Program Files (x86)\MySQL
- C:\ProgramData\MySQL
- C:\Users\[YourUsername]\AppData\Roaming\MySQL
Replace [YourUsername] with your actual Windows username.
Step 4: Clean the Windows Registry
Remove MySQL entries from the Windows Registry.
- Press Windows + R, type regedit, and press Enter to open the Registry Editor.
- Navigate to the following location:
HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB
- Right-click on the MySQL AB folder (or specific MySQL Server version key) and select Delete.
⚠️ Warning: Exercise caution when modifying the Windows Registry. Deleting incorrect registry keys can cause system instability. Consider creating a registry backup before making changes.
Step 5: Remove Environment Variables
Delete any MySQL-related environment variables.
- Right-click on This PC (or My Computer) and select Properties.
- Click Advanced system settings on the left panel.
- In the System Properties window, click the Environment Variables button.
- Review both the User variables and System variables sections.
- Delete any MySQL-related entries, such as variables pointing to MySQL bin directories or MySQL-specific paths.
Step 6: Restart Your Computer
Restart your system to ensure all changes take effect and any lingering processes are terminated.
Verification
After restarting, you can verify the complete removal by:
- Checking that the MySQL service no longer appears in the Services application (services.msc)
- Confirming that the directories listed in Step 3 no longer exist
- Verifying that MySQL does not appear in Programs and Features
MySQL should now be completely removed from your Windows system.