Truncate Tables in MySQL
Using TRUNCATE TABLE to wipe table rows and reset AUTO_INCREMENT primary key sequences.
-- Truncate table data and reset auto increment counter to 1 TRUNCATE TABLE audit_records; -- Truncate tables with foreign keys by disabling checks SET FOREIGN_KEY_CHECKS = 0; TRUNCATE TABLE orders; TRUNCATE TABLE order_items; SET FOREIGN_KEY_CHECKS = 1;
Query OK, 0 rows affected (0.03 sec) Query OK, 0 rows affected (0.02 sec)