Python Django连接mysql错误,显示目标计算机被主动拒绝

Python Django连接mysql错误,显示目标计算机被主动拒绝,python,django,Python,Django,问题描述: Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000001C834726840> Traceback (most recent call last): File "E:\python\env\webnev\lib\site-packages\pymysql\connections.py", line 582, in connect

问题描述:

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000001C834726840>
Traceback (most recent call last):
  File "E:\python\env\webnev\lib\site-packages\pymysql\connections.py", line 582, in connect
    **kwargs)
  File "e:\python\pytho3.6\Lib\socket.py", line 724, in create_connection
    raise err
  File "e:\python\pytho3.6\Lib\socket.py", line 713, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] Unable to connect because the target computer actively refused.
我正在使用django连接到mysql。单击并执行后,我告诉我错误在于目标计算机主动拒绝。我想问这是什么原因造成的。我查了很多资料。基本上,该服务是不开放的,但我的本地计算机上当前的mysql已打开

错误消息:

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000001C834726840>
Traceback (most recent call last):
  File "E:\python\env\webnev\lib\site-packages\pymysql\connections.py", line 582, in connect
    **kwargs)
  File "e:\python\pytho3.6\Lib\socket.py", line 724, in create_connection
    raise err
  File "e:\python\pytho3.6\Lib\socket.py", line 713, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] Unable to connect because the target computer actively refused.

原因是:django的某些端口已绑定,或者端口已更改。尝试将端口更改为3306。
当我将mysql中的端口更改为3306时,django被更改为相应的3306,我可以连接。

在您编写的配置中
POST
而不是
port
。这可能就是问题所在。

MySQL服务器没有在本地主机上运行吗?防火墙?Mysql在本地主机上