Uncategorized

mysql foreign constraints

cannot truncate tables because it has constraints.

 

 

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE table leads;
SET FOREIGN_KEY_CHECKS = 1;

 

 

Note that you need to SET FOREIGN_KEY_CHECKS = 0 with a user that has privilage to do so.

 

 

SET GLOBAL FOREIGN_KEY_CHECKS=0;

 

Leave a Reply

Your email address will not be published. Required fields are marked *