django使用mysql出现警告Warning: (3135, "'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release

django使用mysql出现警告

 

Warning: (3135, "'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.") Warning: (3090, "Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.")

中文意思是

警告:(3135,"'NO_ZERO_DATE', 'NO_ZERO_IN_DATE'和' error_for_division on_by_zero ' sql模式应该与严格模式一起使用。它们将在未来的版本中与strict模式合并。”

警告:(3090,“不建议更改sql模式‘NO_AUTO_CREATE_USER’”。它将在未来的版本中被删除。”

 

就是说SQL modes应该使用安全模式,即该功能将可能在未来的版本中被舍弃或者合并,这是MySQL向后兼容常见的处理方式

 

把setting里的options注释掉就正常了

 

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        "HOST": '127.0.0.1',
        "PORT": '3306',
        "NAME": "guest",
        "USER": "root",
        "PASSWORD": '',
        # "OPTIONS": {
        #     'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
        # },
    }
}

 

posted @ 2019-07-29 08:56  Operater  阅读(12904)  评论(0编辑  收藏  举报