今天迁移数据库的时候,报错:django.db.migrations.exceptions.MigrationSchemaMissing,下面是错误的详细信息:

 1 manage.py@xiaopixiu > migrate
 2 "D:\Program Files\JetBrains\PyCharm 2017.2.2\bin\runnerw.exe" C:\Users\senyu\Anaconda3\envs\py3.6.5\python.exe "D:\Program Files\JetBrains\PyCharm 2017.2.2\helpers\pycharm\django_manage.py" migrate C:/Users/senyu/Desktop/工作文件/xiaopixiu_v2.0/xiaopixiu
 3 System check identified some issues:
 4
 5 WARNINGS:
 6 ?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
 7     HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-sql-mode
 8 Operations to perform:
 9   Apply all migrations: admin, auth, authtoken, common, contenttypes, sessions
10 Running migrations:
11 Traceback (most recent call last):
12   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\backends\utils.py", line 83, in _execute
13     return self.cursor.execute(sql)
14   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\backends\mysql\base.py", line 71, in execute
15     return self.cursor.execute(query, args)
16   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\cursors.py", line 250, in execute
17     self.errorhandler(self, exc, value)
18   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\connections.py", line 50, in defaulterrorhandler
19     raise errorvalue
20   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\cursors.py", line 247, in execute
21     res = self._query(query)
22   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\cursors.py", line 411, in _query
23     rowcount = self._do_query(q)
24   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\cursors.py", line 374, in _do_query
25     db.query(q)
26   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\connections.py", line 277, in query
27     _mysql.connection.query(self, query)
28 _mysql_exceptions.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")
29
30 The above exception was the direct cause of the following exception:
31
32 Traceback (most recent call last):
33   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\migrations\recorder.py", line 55, in ensure_schema
34     editor.create_model(self.Migration)
35   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\backends\base\schema.py", line 312, in create_model
36     self.execute(sql, params or None)
37   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\backends\base\schema.py", line 133, in execute
38     cursor.execute(sql, params)
39   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\backends\utils.py", line 100, in execute
40     return super().execute(sql, params)
41   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\backends\utils.py", line 68, in execute
42     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
43   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\backends\utils.py", line 77, in _execute_with_wrappers
44     return executor(sql, params, many, context)
45   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\backends\utils.py", line 85, in _execute
46     return self.cursor.execute(sql, params)
47   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\utils.py", line 89, in __exit__
48     raise dj_exc_value.with_traceback(traceback) from exc_value
49   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\backends\utils.py", line 83, in _execute
50     return self.cursor.execute(sql)
51   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\backends\mysql\base.py", line 71, in execute
52     return self.cursor.execute(query, args)
53   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\cursors.py", line 250, in execute
54     self.errorhandler(self, exc, value)
55   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\connections.py", line 50, in defaulterrorhandler
56     raise errorvalue
57   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\cursors.py", line 247, in execute
58     res = self._query(query)
59   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\cursors.py", line 411, in _query
60     rowcount = self._do_query(q)
61   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\cursors.py", line 374, in _do_query
62     db.query(q)
63   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\MySQLdb\connections.py", line 277, in query
64     _mysql.connection.query(self, query)
65 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")
66
67 During handling of the above exception, another exception occurred:
68
69 Traceback (most recent call last):
70   File "D:\Program Files\JetBrains\PyCharm 2017.2.2\helpers\pycharm\django_manage.py", line 43, in <module>
71     run_module(manage_file, None, '__main__', True)
72   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\runpy.py", line 205, in run_module
73     return _run_module_code(code, init_globals, run_name, mod_spec)
74   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\runpy.py", line 96, in _run_module_code
75     mod_name, mod_spec, pkg_name, script_name)
76   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\runpy.py", line 85, in _run_code
77     exec(code, run_globals)
78   File "C:/Users/senyu/Desktop/工作文件/xiaopixiu_v2.0/xiaopixiu\manage.py", line 15, in <module>
79     execute_from_command_line(sys.argv)
80   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
81     utility.execute()
82   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\core\management\__init__.py", line 375, in execute
83     self.fetch_command(subcommand).run_from_argv(self.argv)
84   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\core\management\base.py", line 316, in run_from_argv
85     self.execute(*args, **cmd_options)
86   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\core\management\base.py", line 353, in execute
87     output = self.handle(*args, **options)
88   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\core\management\base.py", line 83, in wrapped
89     res = handle_func(*args, **kwargs)
90   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\core\management\commands\migrate.py", line 203, in handle
91     fake_initial=fake_initial,
92   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\migrations\executor.py", line 91, in migrate
93     self.recorder.ensure_schema()
94   File "C:\Users\senyu\Anaconda3\envs\py3.6.5\lib\site-packages\django\db\migrations\recorder.py", line 57, in ensure_schema
95     raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
96 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"))

Python版本为3.6.5, Django版本为2.1.7,,之前在本地迁移数据库的时候是很正常的,迁移到服务器上就报错,然后查看之后,发现本地数据库是5.7.22,服务端数据库版本为5.5.56,然后猜想为数据库版本问题,Django2.1生成的数据库语句和5.5版本的数据库不兼容.因此才会出现这样的错误.

之后查看了Django的发行信息

Djngo2.1只支持MySQL5.6(含)以上版本,所以确定就是MySQL版本问题.

并且,官方宣布,Django2.0是最后一个支持3.4版本的Python,还好我Python版本比较新一些.建议大家以后使用新版的时候,事先阅读一下新版本的新特性.嗯,就是这样

转载于:https://www.cnblogs.com/kuoiea/p/10566153.html

Django2.1迁移数据库出错相关推荐

  1. flask_sqlalchemy迁移数据库出错Context impl MySQLImpl. Will assume non-transactional DDL. No changes in sche

    问题 INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will as ...

  2. git迁移MySQL数据库_Centos7下Gitlab迁移数据库mysql过程

    [root@test ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@test ~]# uname -r ...

  3. 【MOS】如何利用RMAN可传输表空间迁移数据库到不同字节序的平台(文档 ID 1983639.1)...

    如何利用 RMAN 可传输表空间迁移数据库到不同字节序的平台 (文档 ID 1983639.1) 适用于: Oracle Database - Enterprise Edition - 版本 10.1 ...

  4. c语言动态迁移mysql,flask-migrate动态迁移数据库

    了解flask_migrate需要先了解flask-script,那么flask-script的作用是什么呢?flask-script的作用是可以通过命令行的形式来操作Flask.例如通过命令跑一个开 ...

  5. 使用Oracle数据泵迁移数据库

    一.准备目标数据库 1.确保目标数据库的字符集 NLS_CHARACTERSET 和源数据库一致 select * from nls_database_parameters 2.创建要迁移数据库表空间 ...

  6. 数据库本地的sa有个叉号_搞定sql数据库出错,做自己的大神!

    原标题:搞定sql数据库出错,做自己的大神! 怎么办? ERP出现登录不了,异常提示:数据库服务未开启或连接失败等,但实际上服务是开启的,软件安装目录下测试连接加密狗数据库也正常.最后发现sql数据库 ...

  7. 迁移数据库到SQL on Linux Docker

    问题引入 前一篇文章,菜鸟找到了SQL on Linux Docker容器销毁后,容器中的数据库文件可以得以保留的方法,老鸟非常开心.所以,今天又提出了新的问题:"鸟儿,如果我想把我的数据库 ...

  8. 全自动迁移数据库的实现 (Fluent NHibernate, Entity Framework Core)

    在开发涉及到数据库的程序时,常会遇到一开始设计的结构不能满足需求需要再添加新字段或新表的情况,这时就需要进行数据库迁移. 实现数据库迁移有很多种办法,从手动管理各个版本的ddl脚本,到实现自己的mig ...

  9. oracle出错如何备份数据,备份oracle数据库出错

    备份oracle数据库出错 input datafile fno=00027 name=/index/neas_standard01.dbf input datafile fno=00035 name ...

  10. 复习django项目一——迁移数据库

    1.创建django项目 $export PATH=$PATH:/usr/anaconda2/pkgs/django-1.11.3-py36_0/bin/django-admin startproje ...

最新文章

  1. opencv imshow
  2. 人脸识别翼闸使用规范_人行通道闸如何搭配人脸识别使用
  3. Java 比较两个日期的方法
  4. 当你自定义view用的约束之后,放到其他空间算取frame的时候发现frame里的x,y都是0...
  5. 如何修复 SAP UI5 aggregation with cardinality 0..1 相关的错误消息
  6. [经典推荐]事半功倍系列之javascript
  7. 绘图的尺寸_Auto CAD机械绘图尺寸标注教程10(标注多重引线)
  8. [CDLinux]安装向导
  9. python汉化版下载-Python中文版
  10. andr实现微信小程序抓包
  11. mysql数据库事务模拟转账_mysql数据库事务阐发:实现银行转账功能的优化,附代码+实现过程...
  12. PMP知识点(十一、干系人管理)
  13. Typora Beta版过期解决方法
  14. 编写lisp程序解一元二次方程_vb解一元二次方程代码
  15. linux 防火墙文件路径,linux防火墙设置
  16. RAM、 ROM 、SRAM 、DRAM 、SDRAM 、DDR (2、3、4)SDRAM辨析
  17. Arthas - 阿尔萨斯 - 入门使用(Arthas插件)
  18. IEEE SA 会员注册步骤
  19. 和我一起搭建私有物联网云平台
  20. lightroom最新版本下载_277手游盒子最新版本下载(完美世界)

热门文章

  1. dns遭到劫持_关于网站pr劫持的问题,PR劫持是如何实现的呢?
  2. pytorch test单张图片_PyTorch的元学习库:Torchmeta
  3. c++:warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  4. oracle 主键自增函数_在 Oracle 中设置自增列
  5. 局域网屏幕监控软件_如何用局域网桌面监控软件进行局域网电脑桌面监控?
  6. qt控制程序打开记事本_Qt 记事本程序
  7. pat A1052:Linked List Sorting静态链表+链表排序
  8. 百度搜索(URL)中汉字转为什么编码问题
  9. mid=(left+right)1什么含义
  10. c# 拼接字符串换行_零基础小白学习:python之最详细字符串篇