查看mysql啓動日誌html
140213 16:24:19 mysqld_safe Starting mysqld daemon with databases from /data/mydata/ 2014-02-13 16:24:22 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
查閱官方文檔:
mysql
http://dev.mysql.com/doc/refman/5.6/en/upgrading-from-previous-series.html sql
這是數據庫升級過程當中,timestamp在5.6之前的數據庫中默認not null,若是沒有顯示聲明timestamp的默認值,那麼該列用全0的"0000-00-00 00:00:00"做爲默認值
數據庫
在5.6中,時間值是不能爲全0格式,添加explicit_defaults_for_timestamp
參數spa
添加以後,timestamp列能夠設置默認爲空,而且不填充0,若是填充了0,若是SQL_MODE爲strict sql則會報錯日誌
除非顯示指定default current_time和on update current_time
code
在配置文件中加入參數後,建立一張表server
root@localhost>create table tim(dd timestamp,id int); Query OK, 0 rows affected (0.03 sec) root@localhost>desc tim -> ; +-------+-----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-----------+------+-----+---------+-------+ | dd | timestamp | YES | | NULL | | | id | int(11) | YES | | NULL | | +-------+-----------+------+-----+---------+-------+
已經默認null了htm