[Solved] MySQL5.6.44 [Err] 1067 – Invalid default value for create_date settlement programme

Scenario
[Err] 1067 – Invalid default value for ‘create_date’, for the create table species statement as follows.
`create_date` timestamp(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT ‘creation time’ SOLVED
MySQL5.6.44 and MySQL5.7.27 timestamp set default rule changed, not “0000 00-00 00:00:00″
Solution:
Check sql_mode:
mysql> show session variables like ‘%sql_mode%’;
+—————+——————————————————————————————————————————————-+
| Variable_name | Value                                                                                                                                     |
+—————+——————————————————————————————————————————————-+
| sql_mode      | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+—————+——————————————————————————————————————————————-+
1 row in set (0.01 sec)
change sql_mode, remove NO_ZERO_IN_DATE,NO_ZERO_DATE:
mysql> set sql_mode=”ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”;


Read More: