Changing AUTOINCREMENT after cleaning out the tables? Yes, that should work. Be sure no deleted users are referenced by ID in other tables, such as post author or similar. In any case, make a complete backup of the DB before changing anything.
FWIW, phpMyAdmin has a GUI for changing AUTOINCREMENT if you find that more appealing than doing ALTER TABLE queries.
Thread Starter
anonymized-14293447
(@anonymized-14293447)
oh, it’s a new site with no real users, I’m just importing dummy ones, so no risk of cross-referenced IDs 🙂
Thread Starter
anonymized-14293447
(@anonymized-14293447)
Well, it didn’t really work (or maybe that’s how autoincrement works) because I had another admin with ID 34, and the autoincrement started from that, while I was hoping it would fill the positions 2-33 and then from 35 on. But at least nothing broke in the database 🙂
Would it be possible to manually assign ID to the next 33 users, so that I’d fill the gap?
Oh, right. Sorry, I guess I wasn’t very clear on that. You must clear out ALL records with IDs greater or equal to the AUTOINCREMENT you want. You cannot auto-infill values less than the greatest remaining ID.
You’d need to alter the 34 record to have ID 2, which means altering all their related user meta and any author IDs, etc. Carefully constructed UPDATE queries can do this, but it can be error prone. Alternately, delete the user through WP, then add them back after setting the AUTOINCREMENT. However, in doing so, any posts they authored will need to be assigned to someone else. TBH, you should settle for starting at 35. It’s a lot better than 50001 🙂