How to truncate a foreign key constrained table?
This illustration will demonstrate how to solve mysql error when truncating a table with foreign key constraint.
If you are using PHPMYADMIN, it is very easy to truncate a table with foreign key constraint.
1. Login to PHPMYADMIN and click the table you want to truncate.
2. Then go to SQL tab Place your code to truncate the table in the SQL
Editor example truncate table students; Replace students with the
name of the table.
3. At the bottom of the editor untick the "Enable foreign key checks" checkbox as shown below:
[![enter image description here][1]][1]
It will work like magic.
[1]: