Solve the error of "the service does not respond to the control function" when installing the service of MySQL8 ZIP distribution

Solve the error of "the service does not respond to the control function" when installing the service of MySQL8 ZIP distribution

  • 2020.9.30
  • Copyright statement: This article is the original article of the blogger chszs, and shall not be reproduced without the permission of the blogger.

There are usually two ways to install MySQL 8 on Windows systems, such as the latest version 8.0.21. One is to download the MSI release version and use the graphical installation interface to complete the installation step by step. This method is difficult to make mistakes; the other is to download Free installation ZIP distribution (such as mysql-8.0.21-winx64.zip).

When installing the ZIP distribution of MySQL 8, the installation service "mysqld.exe --install mysql8" will not go wrong (I named the service mysql8), but when starting the service, the error shown in the title will appear:

# 如果是Windows 10系统
D:\mysql> sc start mysql8
服务没有响应控制功能。
# 如果是Windows 7等系统
D:\mysql> sc start mysql8
The service is not responding to the control function.
# 说明,用“net start mysql8”命令等效

Whether it is win7 or win10, the installed MySQL service cannot be started. I searched all over the Internet (domestic and foreign), but did not find the correct solution.

Analysis process:

  1. Run mysqld directly, such as "mysqld.exe --console", the database server is running normally, and the client can also access normally;
  2. The MySQL system service installation is OK, but it cannot be started;
  3. This problem may not be reproducible, some Windows hosts do not have this problem.

I did a lot of analysis and research in my spare time, compared the similarities and differences between the two installation methods, analyzed the compilation and construction of the MySQL source code, and finally found that this problem is a problem with the official ZIP distribution itself, and there is a lack of a DLL function library file "VCRUNTIME140_1 .DLL". If a development environment such as Visual Studio has been installed on some Windows computers, this dll library file will exist, and there will be no problem, but for other Windows users, this problem will occur.

Solution: visit https://cn.dll-files.com/vcruntime140_1.dll.html , download the latest version of VCRUNTIME140_1.DLL: 14.26.28804.1 , after downloading, put this file directly into the bin subdirectory of MySQL .

Then run with CMD administrator privileges:

D:\databases\mysql8> net start mysql8
mysql8 服务正在启动 .
mysql8 服务已经启动成功。

This problem is not big, but it is really tricky. When MySQL officially packs the ZIP distribution, add the vcruntime140_1.dll file in the bin subdirectory and then pack it to avoid this problem.
I guess that the computer host that MySQL is officially responsible for packaging and releasing software packages has a Visual Studio environment, so that developers are not aware of this problem, and even if there are user reports, this problem cannot be reproduced.
When retrieving the problem, I found that this problem seems to have existed since MySQL version 5.7, but I have been using MySQL in the Ubuntu environment for a long time, and I have not encountered this problem, and I discovered it recently.

Guess you like

Origin blog.csdn.net/chszs/article/details/108889979