加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Django生成数据表提示:MySQL Strict Mode is not set for datab

发布时间:2020-12-15 17:14:42 所属栏目:大数据 来源:网络整理
导读:警告提示: ?:?(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?erro

警告提示:

?:?(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/1.11/ref/databases/#mysql-sql-mode

解决办法:

setting.py在DATABASESS添加以下代码:

DATABASES?=?{
????'default':?{
????????'ENGINE':?'django.db.backends.mysql',????????'NAME':?'xxxxx',????????'USER':?'root',????????'PASSWORD':?'root',????????'HOST':?'192.168.3.111',????????'PORT':?'3306',????????'OPTIONS':?{
????????????'init_command':?"SET?sql_mode='STRICT_TRANS_TABLES'"

????????}
????}
}

添加代码

????????'OPTIONS':?{
????????????'init_command':?"SET?sql_mode='STRICT_TRANS_TABLES'"

????????}


(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读