The method for returning mysql auto-increment IDs to 0 is always to initialize data for the current project, which is a headache and the auto-increment of database IDS is getting bigger and bigger, to re-start auto-increment from 1: Use the following method: www.2cto.com Method 1: If no data is needed, you can directly clear all the data, and the auto-increment field is restored from 1 to count the truncate table name Method 2: dbcc checkident ('table _ name', reseed, new_reseed_value). The current value is set to new_reseed_value. If the row is not inserted into the table after the table is created, new_reseed_value is used as the ID of the first row inserted after dbcc checkident is executed. Otherwise, new_reseed_value + 1 is used for the next inserted row. If the value of new_reseed_value is smaller than the maximum value in the ID column, error 2627 will be generated when the table is referenced later. Method 2 of www.2cto.com does not clear existing data, and the operation is flexible. It can not only return the auto-increment value to zero, but also apply to Resetting the auto-increment value and inserting new data after deleting a large number of consecutive rows; or starting from a new value, of course, it cannot conflict with an existing one. $ SQL = "delete from $ table_vote"; mysql_query ($ SQL, $ link); $ SQL = "alter table $ table_vote auto_increment = 1"; mysql_query ($ SQL, $ link );