Mysql failed to start: What should I do if the mysql service cannot be started?

醉折花枝作酒筹
Release: 2021-07-12 16:15:00
forward
7928 people have browsed it

After MySQL server8.0 is installed, the startup fails, and the prompt message is as follows: the mysql service cannot be started, and the service does not report any errors. What should we do at this time? Below, the editor will take you through the solution. Friends in need can refer to it.

Mysql failed to start: What should I do if the mysql service cannot be started?

After installation of My SQL server8.0, the startup failed, and the prompt message is as follows:

Try the following steps, and finally Solve the problem:

1 Check the host file (C:\Windows\System32\drivers\etc\hosts) to see if the local domain name has been modified. If the address corresponding to localhost has been modified, it may cause the connection to the mysql server fail.

Solution: Comment out the address mapped by localhost

2 If there is no configuration file in the mysql installation path (C:\Program Files\MySQL\MySQL Server 8.0), manually Create one, the file name is: my.ini, add the following content:

Note: Do not create the data folder manually after the datadir attribute. I tried to create it manually. There will be problems. If you created it yourself, you can delete it and then perform the subsequent operations.

3 In mysql5.7 and above, there is no data directory by default, that is, there is no initialization service. You need to initialize mysql before you can start the service. Otherwise, "the service did not report any errors" will be reported and the startup will fail.

Solution:

a Enter the bin directory of mysql;

b Execute mysqld --initialize-insecure. If executed for the first time, it will take longer and the execution will end. There is no output information. If you check the directory at the same level as bin, there will be an additional data folder with a bunch of files in it.

4 Execute the net start mysql command again to start the service and find that the startup is successful!

Related learning recommendations:mysql tutorial(video)

The above is the detailed content of Mysql failed to start: What should I do if the mysql service cannot be started?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!