MySQL: ERROR 1067 (42000) at line 41: Invalid default value for 'comment_date'

2 posts / 0 new
Last post
#1 Fri, 12/23/2016 - 17:22
antioch

MySQL: ERROR 1067 (42000) at line 41: Invalid default value for 'comment_date'

trying to execute a dump file thru the mysql module, but it keeps tripping on line 41 below:

CREATE TABLE `wp_err_comments` (
  `comment_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `comment_post_ID` bigint(20) unsigned NOT NULL DEFAULT '0',
  `comment_author` tinytext NOT NULL,
  `comment_author_email` varchar(100) NOT NULL DEFAULT '',
  `comment_author_url` varchar(200) NOT NULL DEFAULT '',
  `comment_author_IP` varchar(100) NOT NULL DEFAULT '',
  `comment_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `comment_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `comment_content` text NOT NULL,
  `comment_karma` int(11) NOT NULL DEFAULT '0',
  `comment_approved` varchar(20) NOT NULL DEFAULT '1',
  `comment_agent` varchar(255) NOT NULL DEFAULT '',
  `comment_type` varchar(20) NOT NULL DEFAULT '',
  `comment_parent` bigint(20) unsigned NOT NULL DEFAULT '0',
  `user_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`comment_ID`),
  KEY `comment_post_ID` (`comment_post_ID`),
  KEY `comment_approved_date_gmt` (`comment_approved`,`comment_date_gmt`),
  KEY `comment_date_gmt` (`comment_date_gmt`),
  KEY `comment_parent` (`comment_parent`)
) ENGINE=InnoDB AUTO_INCREMENT=12593 DEFAULT CHARSET=utf8;
Sat, 12/24/2016 - 13:38
antioch

an upgrade to mysql was to blame. in v5.7.8 and later, u need the NO_ZERO_DATE and NO_ZERO_IN_DATE modes enabled in ur config so that "0000-00-00 00:00:00" become valid for various date fields again.

https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html

Topic locked