执行 python manage.py migrate不成功,求解
PS D:\pyProgram\imooc> python manage.py migrate
Traceback (most recent call last):
File "D:\python\anaconda3\lib\site-packages\django\db\backends\base\base.py", line 216, in ensure_connection
self.connect()
File "D:\python\anaconda3\lib\site-packages\django\db\backends\base\base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "D:\python\anaconda3\lib\site-packages\django\db\backends\mysql\base.py", line 227, in get_new_connection
return Database.connect(**conn_params)
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 353, in __init__
self.connect()
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 641, in connect
c.execute(self.init_command)
File "D:\python\anaconda3\lib\site-packages\pymysql\cursors.py", line 148, in execute
result = self._query(query)
File "D:\python\anaconda3\lib\site-packages\pymysql\cursors.py", line 310, in _query
conn.query(q)
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
result.read()
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 1156, in read
first_packet = self.connection._read_packet()
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
packet.raise_for_error()
File "D:\python\anaconda3\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "D:\python\anaconda3\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.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 n
ear 'SET sql_mode='STRICT_TRANS_TABLES'; SET GLOBAL group_concat_max_len=102400;SET c' at line 1")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\pyProgram\imooc\manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "D:\python\anaconda3\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "D:\python\anaconda3\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\python\anaconda3\lib\site-packages\django\core\management\base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\python\anaconda3\lib\site-packages\django\core\management\base.py", line 350, in execute
self.check()
File "D:\python\anaconda3\lib\site-packages\django\core\management\base.py", line 376, in check
all_issues = self._run_checks(
File "D:\python\anaconda3\lib\site-packages\django\core\management\commands\migrate.py", line 59, in _run_checks
issues = run_checks(tags=[Tags.database])
File "D:\python\anaconda3\lib\site-packages\django\core\checks\registry.py", line 71, in run_checks
new_errors = check(app_configs=app_configs)
File "D:\python\anaconda3\lib\site-packages\django\core\checks\database.py", line 10, in check_database_backends
issues.extend(conn.validation.check(**kwargs))
File "D:\python\anaconda3\lib\site-packages\django\db\backends\mysql\validation.py", line 9, in check
issues.extend(self._check_sql_mode(**kwargs))
File "D:\python\anaconda3\lib\site-packages\django\db\backends\mysql\validation.py", line 13, in _check_sql_mode
with self.connection.cursor() as cursor:
File "D:\python\anaconda3\lib\site-packages\django\db\backends\base\base.py", line 255, in cursor
return self._cursor()
File "D:\python\anaconda3\lib\site-packages\django\db\backends\base\base.py", line 232, in _cursor
self.ensure_connection()
File "D:\python\anaconda3\lib\site-packages\django\db\backends\base\base.py", line 216, in ensure_connection
self.connect()
File "D:\python\anaconda3\lib\site-packages\django\db\utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "D:\python\anaconda3\lib\site-packages\django\db\backends\base\base.py", line 216, in ensure_connection
self.connect()
File "D:\python\anaconda3\lib\site-packages\django\db\backends\base\base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "D:\python\anaconda3\lib\site-packages\django\db\backends\mysql\base.py", line 227, in get_new_connection
return Database.connect(**conn_params)
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 353, in __init__
self.connect()
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 641, in connect
c.execute(self.init_command)
File "D:\python\anaconda3\lib\site-packages\pymysql\cursors.py", line 148, in execute
result = self._query(query)
File "D:\python\anaconda3\lib\site-packages\pymysql\cursors.py", line 310, in _query
conn.query(q)
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
result.read()
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 1156, in read
first_packet = self.connection._read_packet()
File "D:\python\anaconda3\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
packet.raise_for_error()
File "D:\python\anaconda3\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "D:\python\anaconda3\lib\site-packages\pymysql\err.py", line 143, 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 u
se near 'SET sql_mode='STRICT_TRANS_TABLES'; SET GLOBAL group_concat_max_len=102400;SET c' at line 1")
PS D:\pyProgram\imooc>