Karaethon Posted July 6, 2019 Share Posted July 6, 2019 I need to reset my autoincrement value, I had a minor goof in my insert code and it ws inserting data wrong, i have fixed it but im now over 1000 rows in and all error posts are deleted, its not a big deal on a bigint but i want to start over at the beginning for my own OCD issues. how/can this be done? Quote Link to comment Share on other sites More sharing options...
benanamen Posted July 6, 2019 Share Posted July 6, 2019 (edited) Truncate the table. It will also delete all the data. TRUNCATE TABLE table_name; TRUNCATE TABLE table_name; Edited July 6, 2019 by benanamen 1 Quote Link to comment Share on other sites More sharing options...
Karaethon Posted July 6, 2019 Author Share Posted July 6, 2019 Thanks. Quote Link to comment Share on other sites More sharing options...
Envrin Posted October 3, 2019 Share Posted October 3, 2019 Another way is to simply: ALTER TABLE table_name SET AUTO_INCREMENT=0; Hope that helps. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.