#1062 - 键 'PRIMARY' 的重复条目 '1' [英] #1062 - Duplicate entry '1' for key 'PRIMARY'

查看:67
本文介绍了#1062 - 键 'PRIMARY' 的重复条目 '1'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里完全不知所措.我有两个数据库.一个在我用于开发的 localhost 站点上,另一个在我的远程站点上用于我的实时(生产)站点.我通过 phpMyadmin 管理它们.正如我几个月来一直在做的那样,当我需要更新实时站点时,我会转储相关数据库并从我的本地主机站点导入数据库.

I am at a complete loss here. I have two databases. One on my localhost site that I use for development and one on my remote site that I use for my live (production) site. I manage both of them through phpMyadmin. As I have been doing for months now, when I need to update the live site, I dump the related database and import the database from my localhost site.

现在,无论我尝试什么,我总是收到此错误:

Now, no matter what I try, I keep getting this error:

错误SQL查询:

--
-- Dumping data for table `oc_address_type`
--
INSERT INTO  `oc_address_type` (  `address_type_id` ,  `address_type_name` ) 
VALUES ( 1,  'Billing' ) , ( 2,  'Shipping' ) ;

MySQL 说:文档

#1062 - 键PRIMARY"的重复条目1"

#1062 - Duplicate entry '1' for key 'PRIMARY'

我尝试在我的本地主机上创建一个新的空白数据库并将其导入但结果相同.我已经验证了所有的表和索引,并没有发现任何错误.

I tried creating a new blank database on my localhost and importing into that but same results. I have validated all of the tables and indexes and cannot find anything wrong there.

请提出任何建议,因为在此问题得到解决之前,我已经完全崩溃了.

Any suggestions please as I am completely down until this gets resolved.

顺便说一下,我完全删除了所有表并导入结构和数据.这一直有效,直到今天.

By the way, I am completely dropping all tables and importing structure and data. This has always worked until today.

推荐答案

您需要使用 drop 语句进行转储.该表存在并且已经有数据并且您尝试插入更多相同的数据.我对 phpmyadmin 不是 100% 确定,但转储将有添加删除表"语句的选项

you need to dump with the drop statements. The table exists and has data already and your trying to insert more which is identical. Im not 100% sure on phpmyadmin but the dumps will have an option for "add drop table" statements

这篇关于#1062 - 键 'PRIMARY' 的重复条目 '1'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆