Solve the problem that the MySQL service on the local computer of MySQL 8.0 stops after starting without reporting any errors

1. The error message when starting MySQL is as follows

(1) "The MySQL service on Local Computer stopped after starting. Some services will automatically stop when not in use by other services or programs."
Insert image description here

(2) When I ran "net start MySQL" in PowerShell, the service failed to start. "The MySQL service failed to start. The service reported no errors."

Insert image description here

The crudest solution is to uninstall and reinstall the service. You can also refer to the following solutions:

2.Solution

The solution may be one of the following. Find your own MySQL problem and make modifications.

2.1 Modify my.ini encoding to ANSI

(1) Right-click Properties in the service to view the location of the my.ini file

Insert image description here

Insert image description here

(2) Rename the original file to my.ini.bak and open it with Notepad.
(3)

Insert image description here

(4) When saving, you may be prompted that it contains Unicode characters, just click OK.

Insert image description here

(5) After completion, run "net start MySQL" in PowerShell, or start it directly in the service. The waiting time is long, but the service starts successfully.

2.2 The path to the MySQL service executable file is incorrect

(1) Check the path of the executable file
Control Panel-Administrative Tools-Service->Select the mysql service->Right-click->Properties, which is what we want to modify The path content of the MySQL service executable file, but cannot be edited directly

(2) Modify the path of the executable file
①Shortcut key WIN+R, enter regedit, and press Enter to open the registry editor
② According to the path HKEY_LOCAL_MACHINE -> SYSTEME -> CurrentControlSet -> services
, for example, mine is mysql57
Insert image description here
③Right-click on ImagePath->Modify-> Modify the correct path of mysqld.exe and my.nini configuration files
This is my path for reference:
"D:\DBSoftWare\mysql\ mysql8\bin\mysqld.exe” --defaults-file="D:\DBSoftWare\mysql\mysql8\my.ini” MySQL

④After modifying the ImagePath value, return to the mysql service->right-click->Properties->General, and check that the path to the executable file has not been updated
⑤This Enter the bin directory of the mysql installation directory and find mysqld.exe; double-click mysqld.exe. At this time, the "path to executable file" configuration in the service properties will be updated to registration. in the table. ⑥After updating the configuration, you need to use the task manager->mysqld.exe->right-click->to end the mysqld.exe process, otherwise the mysql service may not be started in the future

Insert image description here

⑦Restart the mysql service. Shortcut key WIN+R, enter cmd, restart mysql command net start mysql

2.3 Close the mysql80 service in system management

(1) Click on Services and Applications and find MySQL80 in the service
Insert image description here
(2) Right-click MySQL80 and click Stop

Guess you like

Origin blog.csdn.net/y516369/article/details/132947950