How to make the auto-increment ID still start from the vacancy after mysql clears the table data

1. Use the truncate command instead of the delete command mysql> truncate test when emptying the table;
the advantages of using the truncate command:
1), the speed is fast
2), the auto-increment ID can be rearranged, so that the auto-increment ID is still calculated from 1
2. After clearing the table data, use alter to modify the table, mysql>alter table table_name auto_increment=1;

Navicat command line, the command must end with ";"

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324434198&siteId=291194637