在执行mysql数据库时报错
CREATE TABLE `advert_schedule_time` ( `advert_id` int(11) NOT NULL DEFAULT '0' COMMENT '广告id', `stime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '开始时间', `etime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '结束时间', `times` int(11) NOT NULL DEFAULT '0' COMMENT '投放次数', UNIQUE KEY `adverttime` (`advert_id`,`stime`,`etime`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '广告时间排期表';
首先用下面的命令看下sql_mode
show variables like '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
NO_ZERO_IN_DATE
, NO_ZERO_DATE
则执行下面的命令: set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'