问题
Is there a way to set mysql's auto_increment to a certain integer in an "ad hoc" way - for example, N of the latest rows have been deleted in a table, so the primary key/auto_increment is N off from the actual # of rows? Is there a way to set the auto_increment to the right number, or to manually set it?
This seems common, so I believe it has been asked already, but I've not been able to find a solution, other than that this isn't possible or you shouldn't do it.
回答1:
ALTER TABLE tablename AUTO_INCREMENT = 100;
来源:https://stackoverflow.com/questions/3091838/mysql-set-autoincrement-ad-hoc