MySQL delete table rows and reset index

How to delete all rows of a table and also reset the index.

With TRUNCATE TABLE command

TRUNCATE TABLE `table-name`;

With DELETE FROM command

-- FIRST DELETE ALL ROWS
DELETE FROM `table-name`;
-- THEN RESET INDEX TO START FROM 1 AGAIN
ALTER TABLE `table-name` AUTO_INCREMENT = 1;

See here also for reference.

mysql database