我想我解决了。
通过关注此线程
https://stackoverflow.com/a/21740692/7658051
在settings.py中的DATAbaseS条目中,我替换了
'ENGINE': 'django.db.backends.mysql'
与
'ENGINE': 'mysql.connector.django',
再次如此处指定
https://django-mysql.readthedocs.io/zh-CN/latest/checks.html#django-
mysql-w003-utf8mb4
我也加了
'OPTIONS': { # Tell MySQLdb to connect with 'utf8mb4' character set 'charset': 'utf8mb4', }, # Tell Django to build the test database with the 'utf8mb4' character set 'TEST': { 'CHARSET': 'utf8mb4', 'COLLATION': 'utf8mb4_unipre_ci', }然后如果我跑步
python manage.py运行服务器
即使我无法访问http://127.0.0.1:8000/admin,它也似乎可以正常工作,因为我已连接到旧版数据库,因此我仍然必须检查db和仍需学习的内容。
作为第二个证明,当我运行时,该连接现在正在工作
connect_to_mysql_2.py
(在Django上运行与MYSQL数据库连接的服务器时,请参阅(2059,“身份验证插件’caching_sha2_password’”))
我终于明白了
mysql.connector.connection_cext.CMySQLConnection对象位于0x000001DFB7521550
所以我真的认为这次连接已经打开。



