简体   繁体   English

在phpmyadmin中导入sql时出错

[英]Error while importing sql in phpmyadmin

While I'm trying to import a .sql backup in phpmyadmin , I get this error : 当我尝试在phpmyadmin中导入.sql备份时,出现此错误:

****Error** ****错误**

SQL query: SQL查询:

--
-- Dumping data for table `wp_commentmeta`
--
INSERT INTO `wp_commentmeta` ( `meta_id` , `comment_id` , `meta_key` , `meta_value` )

VALUES ( 2, 2, '_wp_trash_meta_status', '0' ) , ( 3, 2, '_wp_trash_meta_time', '1398086942' ) ;

MySQL said: MySQL说:

1062 - Duplicate entry '2' for key 'PRIMARY'** 1062-键“ PRIMARY”的条目“ 2”重复

What should I do? 我该怎么办?

  1. You cant duplicate the data with the same primary key 您不能使用相同的主键复制数据
  2. Truncate your current table and try it again (TRUNCATE your_table;) 截断当前表,然后重试(TRUNCATE your_table;)

    OR DELETE FROM your_table WHERE your_ID_field LIKE 2 或从your_table中删除your_ID_field,如2

  3. IF your ID field is AUTO_INCREMENT field you can slove it like this 如果您的ID字段是AUTO_INCREMENT字段,则可以像这样修改它

     INSERT INTO `wp_commentmeta` ( `meta_key` , `meta_value` ) VALUES ('_wp_trash_meta_status', '0' ), ('_wp_trash_meta_time', '1398086942' ) ; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM