django migrate mysql_Django_执行 migrate 指令报错 : MySQL server version for the right syntax to use near ...

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\migrations\recorder.py", line 67, in ensure_schema

editor.create_model(self.Migration)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\backends\base\schema.py", line 307, in create_model

self.execute(sql, params or None)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\backends\base\schema.py", line 137, in execute

cursor.execute(sql, params)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\backends\utils.py", line 99, in execute

return super().execute(sql, params)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\backends\utils.py", line 67, in execute

return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\backends\utils.py", line 76, in _execute_with_wrappers

return executor(sql, params, many, context)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\backends\utils.py", line 84, in _execute

return self.cursor.execute(sql, params)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\utils.py", line 89, in __exit__

raise dj_exc_value.with_traceback(traceback) from exc_value

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\backends\utils.py", line 82, in _execute

return self.cursor.execute(sql)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\backends\mysql\base.py", line 71, in execute

return self.cursor.execute(query, args)

File "E:\PYTHON_HOME\Python37\lib\site-packages\pymysql\cursors.py", line 170, in execute

result = self._query(query)

File "E:\PYTHON_HOME\Python37\lib\site-packages\pymysql\cursors.py", line 328, in _query

conn.query(q)

File "E:\PYTHON_HOME\Python37\lib\site-packages\pymysql\connections.py", line 517, in query

self._affected_rows = self._read_query_result(unbuffered=unbuffered)

File "E:\PYTHON_HOME\Python37\lib\site-packages\pymysql\connections.py", line 732, in _read_query_result

result.read()

File "E:\PYTHON_HOME\Python37\lib\site-packages\pymysql\connections.py", line 1075, in read

first_packet = self.connection._read_packet()

File "E:\PYTHON_HOME\Python37\lib\site-packages\pymysql\connections.py", line 684, in _read_packet

packet.check_error()

File "E:\PYTHON_HOME\Python37\lib\site-packages\pymysql\protocol.py", line 220, in check_error

err.raise_mysql_exception(self._data)

File "E:\PYTHON_HOME\Python37\lib\site-packages\pymysql\err.py", line 109, in raise_mysql_exception

raise errorclass(errno, errval)

django.db.utils.ProgrammingError: (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")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "manage.py", line 21, in

main()

File "manage.py", line 17, in main

execute_from_command_line(sys.argv)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line

utility.execute()

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\core\management\__init__.py", line 375, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv

self.execute(*args, **cmd_options)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\core\management\base.py", line 364, in execute

output = self.handle(*args, **options)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\core\management\base.py", line 83, in wrapped

res = handle_func(*args, **kwargs)

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\core\management\commands\migrate.py", line 234, in handle

fake_initial=fake_initial,

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\migrations\executor.py", line 91, in migrate

self.recorder.ensure_schema()

File "E:\PYTHON_HOME\Python37\lib\site-packages\django\db\migrations\recorder.py", line 69, in ensure_schema

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"))

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值