您好我正在尝试将数据库导入到活动服务器,并且我不断收到此错误消息:
SQL查询:
--
-- Dumping data for table `wp_2_comments`
--
INSERT INTO `wp_2_comments` ( `comment_ID` , `comment_post_ID` , `comment_author` , `comment_author_email` , `comment_author_url` , `comment_author_IP` , `comment_date` , `comment_date_gmt` , `comment_content` , `comment_karma` , `comment_approved` , `comment_agent` , `comment_type` , `comment_parent` , `user_id` )
VALUES ( 1, 1, 'Mr WordPress', '', 'http://www.kbee.co.za/', '', '2013-12-22 17:34:17', '2013-12-22 17:34:17', 'Hi, this is a comment.\nTo delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.', 0, '1', '', '', 0, 0 ) ;
MySQL说:文档
以下是该特定表格的结构:
--
-- Table structure for table `wp_2_comments`
--
CREATE TABLE IF NOT EXISTS `wp_2_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 DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `wp_2_comments`
--
INSERT INTO `wp_2_comments` (`comment_ID`, `comment_post_ID`, `comment_author`, `comment_author_email`, `comment_author_url`, `comment_author_IP`, `comment_date`, `comment_date_gmt`, `comment_content`, `comment_karma`, `comment_approved`, `comment_agent`, `comment_type`, `comment_parent`, `user_id`) VALUES
(1, 1, 'Mr WordPress', '', 'http://www.kbee.co.za', '', '2013-12-22 17:34:17', '2013-12-22 17:34:17', 'Hi, this is a comment.\nTo delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.', 0, '1', '', '', 0, 0);
根据我在其他主题中看到的情况,这可能是因为表正在复制或者主键字段没有自动递增。表中的结构将主键字段设置为自动递增,我已经尝试删除该特定表并尝试再次导入,但我发现没有快乐。
答案 0 :(得分:0)
对于自动增量值,即使删除值为1的行,自动增量col的下一个值将为2而不是1.so使用
截断表 truncate wp_2_comments
然后尝试插入将从1开始计数的值。
也改变了这个
ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
到
ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
首先执行此查询
CREATE TABLE IF NOT EXISTS `wp_2_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 DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
然后执行此查询
truncate wp_2_comments