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'",
        # },
    }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM