MySQL 1005 – errno 121 error resolution

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

Today, I found the error of 1005 — errno 121 when modifying the database foreign key~

After searching the Internet, it’s basically an answer. I don’t know if it’s OK to clear the data and restore it again. Anyway, I think it’s a little troublesome to clear the data and restore it again. Then I didn’t try~~

Finally found a solution ~ ~ in fact, this problem is just foreign key name conflict~

Reason: the foreign key name of this table setting is the same as that of other table setting before. Then there is a conflict, and this error is reported

Solution: it’s very simple ~ just change the foreign key name (note it’s not the field name)~~

As the example in the figure above ~ ~ shows that the foreign key name userid already exists, and then it is changed to uid successfully~~

Similar Posts: