码迷,mamicode.com
首页 > 数据库 > 详细

django:ySQL Strict Mode is not set for database connection 'default'

时间:2018-12-12 00:19:28      阅读:402      评论:0      收藏:0      [点我收藏+]

标签:vat   配置   activate   def   ongl   pass   back   ini   man   

?: (mysql.W002) MySQL Strict Mode is not set for database connection ‘default‘
        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

增加黄色配件的配置:

DATABASES = {
‘default‘: {
# ‘ENGINE‘: ‘django.db.backends.sqlite3‘,
# ‘NAME‘: os.path.join(BASE_DIR, ‘db.sqlite3‘),
‘ENGINE‘: ‘django.db.backends.mysql‘,
‘NAME‘: ‘erebus‘,
‘USER‘: ‘root‘,
‘PASSWORD‘: ‘root‘,
‘HOST‘: ‘127.0.0.1‘,
‘PORT‘: ‘3306‘,
‘OPTIONS‘: {
"init_command": "SET sql_mode=‘STRICT_TRANS_TABLES‘",
}

}
}



参考:https://www.jianshu.com/p/bc41a8bf9d9b

django:ySQL Strict Mode is not set for database connection 'default'

标签:vat   配置   activate   def   ongl   pass   back   ini   man   

原文地址:https://www.cnblogs.com/shengulong/p/10105248.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!