为了账号安全,请及时绑定邮箱和手机立即绑定

如何解决mysql连接错误

如何解决mysql连接错误

芜湖不芜 2023-10-18 20:46:26
我尝试连接我的数据库。检查 settings.py 中的所有数据库设置并且它们是正确的。当我运行服务器时,我遇到如下所示的错误。我在互联网上搜索并找到了解决方案,但所有这些都适用于较低的 python 版本。我正在使用最新的 python 版本。我的错误是:System check identified no issues (0 silenced).Exception in thread django-main-thread:Traceback (most recent call last):File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_innerself.run()File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in runself._target(*self._args, **self._kwargs)File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapperfn(*args, **kwargs)File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 120, in inner_runself.check_migrations()File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 453, in check_migrationsexecutor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/migrations/executor.py", line 18, in __init__self.loader = MigrationLoader(self.connection)File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/migrations/loader.py", line 49, in __init__self.build_graph()File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/migrations/loader.py", line 212, in build_graphself.applied_migrations = recorder.applied_migrations()
查看完整描述

1 回答

?
翻翻过去那场雪

TA贡献2065条经验 获得超13个赞

这是关于以前版本的 django 的老问题。目前是3.1.2,导致问题的代码块已修复。

https://github.com/django/django/blob/master/django/db/backends/mysql/operations.py

pip install -U django如果你的 django 版本比 3.0.0 更新,你可以尝试一下 (好)

其他选择是在 virtualenv 中的相关行更改 django 版本源代码(丑陋),或者猴子修补相关功能(不好)


查看完整回答
反对 回复 2023-10-18
  • 1 回答
  • 0 关注
  • 60 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信