0

After trying to import my database.sql, I received this error.

ERROR 1062 (23000) at line 3907: Duplicate entry '1985' for key 'PRIMARY'

I've tried to read here but I really don't understand them. Is there a solution that I can use to import my database properly?

Thanks,

user3416962
  • 89
  • 1
  • 2
  • 7

3 Answers3

0

You have the same Primary Key in your import file. Go to that line and remove that line or the second possibility is that you set the flag to ignore the IDs but then you have inconsistent data and a dublicate primary key.

How to skip row when importing bad MySQL dump

Community
  • 1
  • 1
René Höhle
  • 26,716
  • 22
  • 73
  • 82
0

It is a bug. Just change INSERT INTO to REPLACE INTO in self-contained file.

Oleg Mikhailov
  • 252
  • 1
  • 8
0

Because the Primary-key,we can't insert duplicate data,so before import database sql files,we must clear the database or tables;