How to Truncate a Table in MySQL
Be very careful with this command. It will empty the contents of your MySQL table and there is no undo. This is useful in development, but you'll rarely want to do this in production.
TRUNCATE TABLE table_name; --the TABLE keyword is actually optional: TRUNCATE table_name;
If the table contains an
AUTO_INCREMENT column, the counter for it will also get reset. Note that this behavior is different vs other databases where you need to reset the counter yourself.