Home >Database >Mysql Tutorial >Mysql configuration error cannot start the service
The solution to the problem that mysql configuration error cannot start the service: 1. Comment out the address mapped by localhost; 2. Enter the bin directory of mysql and execute the [mysqld --initialize-insecure] command.
Mysql configuration error cannot start the service solution:
1. Check the host file (C:\Windows \System32\drivers\etc\hosts), whether 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 to fail.
Solution: Comment out the address mapped by localhost
2. If there is no configuration file in the installation path of mysql (C:\Program Files\MySQL\MySQL Server 8.0), then Create one manually, 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 manually create it. There will be problems with creation. If you created it yourself, you can delete it and then perform the subsequent operations.
3. In mysql5.7 or 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. After the execution, no information is output. 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!
More related free learning recommendations: mysql tutorial(Video)
The above is the detailed content of Mysql configuration error cannot start the service. For more information, please follow other related articles on the PHP Chinese website!