Since I haven't used MySQL for a long time, I encountered a problem when reinstalling MySQL today and was stuck for nearly 2 hours. . . . . .
Since I have previously installed MySQL, I must first uninstall the original MySQL when reinstalling.
The correct uninstallation process is given below (The author made a mistake during uninstallation and the installation process was stuck for nearly 2 hours.)
- Stop the MySQL service,
open Run, enter services.msc and click "OK" to bring up the system service.
- Uninstall MySQL related components
Open Control Panel -> Uninstall a program -> Uninstall all MySQL related components
- Delete the MySQL installation directory
- Delete the MySQL data directory.
The data storage directory is in C:\ProgramData\MySQL. Delete the folder directly.
Pay special attention here
ProgramData under the C drive is a hidden folder. The author didn't see this folder at the time, so he simply ignored this step. Causes an error during installation.
We open the folder and click View->Show->Hidden Items to see the folder
- Open the service again and check whether there are any MySQL uninstallation residues.
If MySQL has been uninstalled, but through Task Manager -> Services, you can see that the MySQL service is still remaining in the system service.
Solution:
Run the cmd command line in administrator mode and enter the following command:
sc delete service name (such as MySQL80)
to delete the service.
Problems encountered
If an operation error occurs during uninstallation, an error will definitely be reported during installation, soUninstallation must be strictly carried out according to the above process.
The author keeps reporting errors here and cannot continue the installation. As long as you strictly follow the uninstallation process, there will be no problems with the installation.
The specific MySQL installation process is introduced in detail in another blog of the author. You can refer to it: MySQL Database - Getting Started
Summary: Master the correct way to uninstall MySQL, paying special attention to the details.