
SET @row_num := 0;
-- Step 2: Update the user IDs ordered by the timestamp
UPDATE users
SET id = (@row_num := @row_num + 1)
ORDER BY date ASC;
-- Step 3: Reset the auto-increment counter to the next available number
ALTER TABLE users AUTO_INCREMENT = 1;
Last Updated: December 31, 1969