用Django框架数据库迁移SQL语法错误

最近本人在学习Django框架,在练习数据库迁移时一直报错,查了半天找不到原因,我每一步都是按照教学,甚至重做了N遍,劳烦各位帮忙解惑。
raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table ((1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6) NOT NULL)' at line 1"))
#抛出migrationschemammissing ("Unable to create the django_migrations table (%s)") % exc)
#django.db.migrations.exceptions. migrationschemammissing:无法创建django_migrations表(1064,"你的SQL语法出错; 检查对应于您的MySQL服务器版本的手册,以正确的语法使用接近'(6)NOT NULL)'在第1行"))

要看你django版本和mysql版本是不是匹配

不需要降版本,只需要在settings.py同及目录下的__init__.py中加入下列代码即可实现迁移

import pymysql

pymysql.version_info = (1, 4, 6, 'final', 0)  # change mysqlclient version
# 引入mysql数据库管理端
pymysql.install_as_MySQLdb()

img

有帮助请采纳,有问题继续交流,你的采纳是对我回答的最大的肯定和动力