I think I get foreign key constraint error when I try to truncate innodb tables. I was not having problems with this when using MyISAM.
Is there an easy way to force truncate all tables? Or should I just make a script to drop the database, create new one and then create the tables from scratch?
Connect to the target database. Select all tables from the left sidebar. Right-click and choose delete, or simply hit delete button. Press Cmd + S to commit changes to the server.
About the FK constraints, you could disable them with next statements -
SET FOREIGN_KEY_CHECKS = 0;
...DML statements
SET FOREIGN_KEY_CHECKS = 1; -- enable checking
If you have foreign key problems during your operation you can:
ALTER TABLE tablename DISABLE KEYS
then do your business, and afterwards re-enable keys with:
ALTER TABLE tablename ENABLE KEYS
This techinique is used in MySQL dumps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With