根据报错猜测可能是因为MySQL版本的问题,导出的SQL文件是从MySQL 5.6导出的, 目前Mac上面的MySQL版本是5.7
查询官网发现:The DATE type is used for values with a date part but no time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31'.
The DATETIME type is used for values that contain both date and time parts. MySQL retrieves and displays DATETIME values
in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.
The TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of
'1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.
故相关的默认值需要设置成'1000-01-01 00:00:00' 到 '9999-12-31 23:59:59' 之间即可
MySQL设置默认为当前时间日期
一般给创建时间和更新时间给定当前时间和日期在某些场景下是很有效果的。
新建测试表如下:CREATE