☰ Home Sign In

How to regenerate user IDs in MySQL

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

Comments

Please login to comment

Comment:*
Rating:

instagram youtube x tiktok

Domain Registration

Hosting

Website Builder

Web Design

SSL Certificates

Website Security

Microsoft 365

SEO

Email Marketing

Privacy Policy

Terms Of Service

Contact Support

Blog

WHOIS

© 2026 Fagan Media