mysqlsqlphpmyadmin

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


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:

Error SQL query:

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

MySQL said: Documentation

#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.


Solution

  • 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