问题
5.6.30-log版本的执行insert语句,给非空TIMESTAMP类型字段update_time赋值null,提示 update_time could not be null
原因
- explicit_defaults_for_timestamp
MySQL 5.6版本引入explicit_defaults_for_timestamp来控制对timestamp NULL值的处理
如果该参数不开启,则对timestamp NOT NULL插入NULL值,不报错,无warning,插入后的值为当前时间
如果在my-default.ini中explicit_defaults_for_timestamp=1
那么插入该值的时候会报错提示该列can not be null
建议开启该值