I imported database backup through terminal . in terminal it gave error

ERROR 1062 (23000) at line 1016624: Duplicate entry '0' for key 'PRIMARY'

then I used the below commands to resolve this -
TRUNCATE log_customer; TRUNCATE log_quote; TRUNCATE log_summary; TRUNCATE log_summary_type; TRUNCATE log_url; TRUNCATE log_url_info; TRUNCATE log_visitor; TRUNCATE log_visitor_info; TRUNCATE log_visitor_online; But still in admin panel I am getting error-

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY', query was: INSERT INTO adminnotification_inbox (severity, date_added, title, description, url) VALUES (?, ?, ?, ?, ?).

2 Answers 2


Please check your database because it contains duplicate records so it shows "Duplicate entry violation" error


Truncating the log tables does not make sense here, as the CONSTRAINT is in adminnotification_inbox table. You could truncate that table (they just contain notification in admin anyway).

However, the issue seems to be that the increment is incorrect (set to 0). You can change this with: ALTER TABLE adminnotification_inbox AUTO_INCREMENT = {HIGHEST id + 1};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.