Django2.2连接MySQL问题解决

Posted 冷水泡茶

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Django2.2连接MySQL问题解决相关的知识,希望对你有一定的参考价值。

报错一:

django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.

解决方法:编辑文件,注释掉如下行:

version = Database.version_info
# if version < (1, 3, 13):
#     raise ImproperlyConfigured(‘mysqlclient 1.3.13 or newer is required; you have %s.‘ % Database.__version__)

 

报错二:

File "D:datagitee.comExamOnlinevenvlibsite-packagesdjangodbackendsmysqloperations.py", line 146, in last_executed_query query = query.decode(errors=‘replace‘) AttributeError: ‘str‘ object has no attribute ‘decode‘

解决方法:

编辑文件operations.py,注释掉如下行

query = getattr(cursor, _executed, None)
# if query is not None:
# query = query.decode(errors=‘replace‘)
return query

 

以上是关于Django2.2连接MySQL问题解决的主要内容,如果未能解决你的问题,请参考以下文章

Django2.2连接MySQL报错Authentication plugin 'caching_sha2_password' cannot be loaded

django2.2/mysql ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3

django2.2

连接MySQL出现错误:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)(代码片段

稍微记录下Django2.2使用MariaDB和MySQL遇到的坑

Django_连接MySQL