MySQLdb.OperationalError: (2002, "Can't connect to server on 'localhost' (10061)")
时间: 2023-10-26 10:35:59 浏览: 39
This error occurs when the MySQL database server is not running or is not accessible. It could also be caused by incorrect login credentials or incorrect configuration settings in the MySQL configuration file.
To resolve this error, try the following steps:
1. Verify that the MySQL server is running. You can check this by running the command `sudo service mysql status` on Linux or `net start mysql` on Windows.
2. Check if the MySQL server is listening on the correct port. By default, MySQL listens on port 3306. You can check this by running the command `netstat -an | grep 3306` on Linux or `netstat -ano | findstr "3306"` on Windows.
3. Verify that your login credentials are correct. Make sure that you are using the correct username and password to connect to the MySQL server.
4. Check if the MySQL configuration file is correct. Verify that the configuration file contains the correct settings for the MySQL server.
5. If none of the above steps work, try restarting the MySQL server by running the command `sudo service mysql restart` on Linux or `net stop mysql` followed by `net start mysql` on Windows.
If the issue still persists, it is recommended to seek further assistance from a MySQL expert or your system administrator.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![h](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)