在mysqlteam的成员Morgan Tocker的博文http://www.tocker.ca/2014/01/14/making-strict-sql_mode-the-default.html中,提到了mysql 5.6中默认用的是严格模式了,就是在my.cnf中
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
其中:
STRICT_ALL_TABLES - Behave more like the SQL standard and produce errors when data is out of range.
STRICT_TRANS_TABLES - Behave more like the SQL standard and produce errors when data is out of range, but only on transactional storage engines like InnoDB.
由于mysql 5.6默认用innodb ,所以用STRICT_TRANS_TABLES也容易理解。用了这个选项的话,
那么数据库中如果是非空值的话就得设置默认值了,否则是报错的
此外,在http://www.tocker.ca/2013/11/01/proposal-to-simplify-sql-modes.html中还提到要去掉多余的sql_mode,比如:
ERROR_FOR_DIVISION_BY_ZERO, NO_ZERO_DATE and NO_ZERO_IN_DATE.
不过这好像还在讨论阶段
mysql 5.6中关于STRICT_TRANS_TABLES的讨论
原创
©著作权归作者所有:来自51CTO博客作者mb5c80f4c73b73a的原创作品,请联系作者获取转载授权,否则将追究法律责任
下一篇:(转)JAVA获得机器码的实现
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章