Can I reset the auto_increment field in mySql?

Can I reset the auto-increment index of a MySQL table so that it starts again from zero?

I deleted all the rows in the table - how can I reset to use this counter?

+1
source share
2 answers

To remove all rows from the MySQL table AND reset the auto_increment value, use the truncate command.

http://dev.mysql.com/doc/refman/5.7/en/truncate-table.html

+7
source

Or just crop the table, and do not delete the roles - this reduces and re-adds the table, resetting the auto-increment values ​​in the process

+5
source

Source: https://habr.com/ru/post/1314344/


All Articles