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:
- [Solved] MYSQL Error when deleting a table: Cannot delete or update a parent row: a foreign key constraint fails
- [Solved] MYSQL Error: Cannot delete or update a parent row: a foreign key constraint fails
- MySQL Error Number 1005 Can’t create table (Errno:150)
- Error in modifying data element data type [How to Solve]
- Python TypeError: __init__() missing 1 required positional argument: ‘on_delete’
- Request failed with status code 500 & Self referencing loop detected for property ‘xx‘ with type
- Error in importing excel file from SQL Server
- [Solved] Oracle Import Error:field in data file exceeds maximum length
- [Solved] Springboot Error: sprintgboot Unknown column ‘name’ in ‘field list’
- MySQL ERROR 1005: Can’t create table (errno: 150) [How to Solve]