MYSQL foreign key constraint failed

I have two tables pre_exp_details(parent) and post_exp_details(child).
Firstly I had set a foreign key to post_exp_details from another table called mfd(parent).
Now I want to change the foreign key of post_exp_details from table pre_exp_deatils.
But I am getting foreign key constraint failed error. How to solve this problem.


This probably means that your constraint is not valid given the current data in the tables - an entry in post_exp_details doesn’t have a corresponding entry in pre_exp_details. If you give us the structure of both tables and the foreign key you’re trying to set up, we can help you more.

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service