I have a MySQL table with an auto increment primary key. I deleted some rows in the middle of the table. Now I have, for example, something like this in the ID column: 12, 1
SELECT * from `user` ORDER BY `user_id`; SET @count = 0; UPDATE `user` SET `user_id` = @count:= @count + 1; ALTER TABLE `user_id` AUTO_INCREMENT = 1;
if you want to order by
order by