Friday, October 22, 2010

High Definition Pokemon Images

Temporarily disable the foreign keys in MySQL

If we are working with a pattern of InnoDB tables, we may need to update some tables in a targeted way.
Because referential integrity introduced by the foreign keys, even a simple "delete table" is not feasible. In this case you can resolve the problem by removing temporarily the use of references to foreign keys:

USE `` ilMioDb;

September FOREIGN_KEY_CHECKS = 0;

TRUNCATE `` table_1;
table_2 `DELETE`;
OTHER OPERATIONS ...

September FOREIGN_KEY_CHECKS = 1;

0 comments:

Post a Comment