Mysql导入数据报错,1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'C16X01' at row 1, Time: 0.001000s,错误描述为datetime字段默认不能为0。
解决办法:
1、修改全局sql_mode
查看全局sql_mode
select @@global.sql_mode;
去掉NO_ZERO_IN_DATE,NO_ZERO_DATE。
set @@global.sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
2、修改当前sql_mode
select @@sql_mode;
set @@sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';