Mysql adds foreign key error: 1452 Cannot add or update a child row:a foreign key constraint fails

Regarding the above problem, the primary and foreign keys need to be configured during development. I have two tables A and B, the company name column company_name in table A, and the attribution company column in table B. Table A is the main table and table B is the secondary table. .

Among them, the name in table A has data, but table B is a new column and no data has been written, so an error is reported. After adding data in table B, the primary and foreign key configuration is completed.

Guess you like

Origin blog.csdn.net/Joker6578/article/details/125215041
Recommended