The Solution of Unable to Stop and Delete MySQL Service under Windows

  • 2021-07-09 09:26:17
  • OfStack

I installed MySQL on the Windows operating system by extracting the compressed package. This is the specific method of installation: click here. Execute the following command:


mysqld --install MySQL --defaults-file=[ini Absolute path of configuration file ]

When executing the above command, the wrong configuration file path was entered. Although the system may return success. And the commands mysqld-initialize can also be executed and generate data files. But when I execute net start mysql, the system will be prompted that the service is starting. The reason is that my configuration file path is wrong, which leads to an abnormal situation when the service starts. At this point, the MySQL service cannot be started or stopped through the command line and control panel. The MySQL service could not be removed either.

Solution:

Control Panel → Upper Right View Mode Select Large Icon → Administrative Tools → Services → Select MySQL.

At this time, you can see that there are no options to stop, restart and pause at all. At this time, you need to do this:

Right-click MySQL service → Properties → General tab → "Startup type", select Disable → Restart computer → Open command line as administrator → cd command to enter bin folder under MySQL installation path.

Because the MySQL service is set to stop booting and rebooting the computer, the MySQL service is stopped at this time.

Command line entry command:


mysqld remove MySQL

The command can be executed normally, and the incorrectly configured MySQL service can be deleted after the command is executed. Then delete all the files under the data folder of MySQL, and install MySQL step by step from scratch.


Related articles: