The solution to the problem that mysql cannot connect to the server: first open cmd as an administrator; then enter the bin directory where mysql is installed and execute "mysqld.exe -install"; then find MySQL in the service; finally execute the command " mysqld --initialize".
Recommended: "mysql video tutorial"
The error I encountered is as shown below: ( Unable to connect to the server, MySQL cannot be found in the service, and an error is reported when entering net start mysql in cmd)
Solution:
Open as administrator cmd, enter the bin directory of mysql installation and execute mysqld.exe -install
Then we can find MySQL in the service
If cmd and then enter net start mysql fails to start, you can try entering the following command:
mysqld --initialize //在5.7需要初始化data目录
Finally successful
The above is the detailed content of What should I do if mysql cannot connect to the server?. For more information, please follow other related articles on the PHP Chinese website!