Errno 121, duplicate key on write or update?

后端 未结 4 760
既然无缘
既然无缘 2020-12-07 00:36
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MO         


        
4条回答
  •  心在旅途
    2020-12-07 01:08

    This answer comes from the comment to the answer from @Michael Berkowski. I post it as an answer as it actually worked for me:

    I was getting the errno 121 even after changing the constraint names across multiple tables. The problem was that even across different tables you cannot have the same constraint name. I was using fk_entryid in table1 and table2 and had to change them to fk_table1_entryid and fk_table2_entryid respectively to make it work.

提交回复
热议问题