Posts

Showing posts from October, 2019

MySQL Foreign Key Error[Solved] Error code 1215 & Error code 1452

Image
MySQL Foreign key Error 4X In this blog, we’ll explain how to resolve MySQL Foreign key  error code 1215 : Cannot add foreign key constraint and  Error code 1452 : Cannot add or update a child row a foreign key constraint failed. There are actually many reasons this can happen, we explain most common reasons why you can get MySQL  Error Code 1215 , and  Error code 1452  how to diagnose your case to find which one is affecting you, and provide solutions for adding the foreign key. MySQL doesn’t provide the exact root cause of Foreign key error message ERROR 1215 (HY000): Cannot add foreign key constraint Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails You need to run “ show engine innodb status ;” command to get exact root cause of the foreign key error. This command returns all InnoDB engine details with large content and needs to grep the “LAST FOREIGN KEY ERROR” session. It is a bit difficult. if You need easy solution Smart MySQ