简体   繁体   中英

Record not getting deleted from MySQL database

I added a record in a table in MySQL database, now I am trying to delete that particular record from table, but it is not getting deleted & showing this message:

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

How do I delete this entry?

You can not get this error during DELETE . UPDATE or INSERT can return that So either you are not running DELETE or you have trigger on your table, that is making some other changes, that give you that error.

If child tables have ON DELETE CASCADE ,check them for triggers as well.

delete from table_name [where condition];

use this statement, replace table_name with your table name and put the condition.

If you do not specify where clause, every records will be deleted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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