Home >Database >Mysql Tutorial >What should I do if mysql cannot connect to the database?

What should I do if mysql cannot connect to the database?

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-05-20 15:12:0619411browse

Solution: First press the "win r" key on the keyboard to open the run window; then enter "services.msc" in the window and press the Enter key on the keyboard; then double-click mysql with the mouse. In the pop-up window, select "Automatic" for "Startup type", click "Start", select "Apply"; finally click the "OK" button.

What should I do if mysql cannot connect to the database?

The operating environment of this tutorial: windows7 system, mysql8.0 version, Dell G3 computer.

When opening the DOS window and entering the mysql connection command, the error message "Cannot connect to MySQL server on 'localhost' (10061)" is prompted, as shown below:

The cause of the above problem may be that the local service is not turned on. You need to turn on the local service. Press Win r to run this command. In the pop-up window, enter services.msc and hit Enter, as shown below:

Find MySQL and double-click it, as shown below:

After double-clicking, this box will pop up. Select "Automatic" for the startup type, click the "Start" button, click the "Apply" button, and click the "OK" button, as shown below:

## Next, you can connect to the local MySQL database, as shown below:

Related recommendations: "

mysql tutorial"

The above is the detailed content of What should I do if mysql cannot connect to the database?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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