Recreate a auto increment column in mysql
If you have a MySQL table which uses a auto increment column, you might have noticed that sometimes this column can skip a few numbers, especially if you delete from the table.
For this example lets assume that your table is called websites and the auto increment column is called id.
So, first drop the column from the table:
alter table websites drop id;
alter table websites auto_increment=1;
alter table websites add id int not null auto_increment primary key first;
Was this article helpful? Then please donate to keep The IT Community alive...
If you found this article helpful please share it, comment and help others by writing your own article.
Translate this page: