当前位置:网站首页>Django 无法链接mysql数据库

Django 无法链接mysql数据库

2022-08-09 11:30:00 CSDN问答

Django 无法链接mysql数据库

自己写的python 脚本可以连接上数据库,

pymysql.connect(host = host, user = username, password=pwd, database = database_name)

但是启动Django 整个服务的时候就无法链接上了

运行结果及报错内容
/root/.local/lib/python3.6/site-packages/paramiko/transport.py:169: CryptographyDeprecationWarning: Blowfish has been deprecated'class': algorithms.Blowfish,System check identified no issues (0 silenced).Unhandled exception in thread started by .wrapper at 0x7fcf8f215e18>Traceback (most recent call last):File "/root/.local/lib/python3.6/site-packages/pymysql/connections.py", line 614, in connect(self.host, self.port), self.connect_timeout, **kwargsFile "/usr/local/python3/lib/python3.6/socket.py", line 724, in create_connectionraise errFile "/usr/local/python3/lib/python3.6/socket.py", line 713, in create_connectionsock.connect(sa)ConnectionRefusedError: [Errno 111] Connection refusedDuring handling of the above exception, another exception occurred:Traceback (most recent call last):django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on 'xx.db.com' ([Errno 111] Connection refused)")

python3.6, 和3.7都报一样的错

我的解答思路和尝试过的方法
有没有谁遇到同样的问题,给个思路
原网站

版权声明
本文为[CSDN问答]所创,转载请带上原文链接,感谢
https://ask.csdn.net/questions/7766934