explicit_defaults_for_timestamp
MySQL
5.6版本引入
explicit_defaults_for_timestamp
来控制对timestamp NULL值的处理
如果该参数不开启,则对timestamp NOT NULL插入NULL值,不报错,无warning,插入后的值为当前时间
如果在my.cnf中explicit_defaults_for_timestamp=1
那么插入该值的时候会报错提示该列can not be null
建议开启该值
mysql> show variables like '%explicit_defaults_for_timestamp%';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| explicit_defaults_for_timestamp | OFF |
+---------------------------------+-------+
1 row in set (0.00 sec)
mysql> show create table helei\G
*************************** 1. row ***************************
Table: helei
Create Table: CREATE TABLE `helei` (