No announcement yet.

Resequence User IDs?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Resequence User IDs?

    Hello vB Folks!

    We noticed that, somehow, our user database is strange. The last registered userID was:

    (id: 302028490)
    But, we only have around 50,000 registered users (we purge inactive users from time to time).

    Is there a script to resequence the userIDS?


  • #2
    Erg. I had the same issue a while ago, and it was awful. The ID field couldn't go any higher than the value it was at (some ungodly high number like the one you have), and thus new accounts couldn't be registered.

    Firstly, you need to check and see what the "real" value of the next ID should be. If you have 50,000 members, then the next ID should be 50001 instead of 302028490. This is an example, since in many cases the number of members doesn't match the IDs due to deleted users and such. So, basically, you need to check your database and find out what the real next value is, taking into consideration what I mentioned.

    Next, delete all of the tables that have an ID higher than what the real value is. So, any that have 302028490 and higher need to be deleted (and any lower, if there are any like that. Again, just make sure you have the correct ID number and you delete all tables that have a value higher than it.)

    Now, take the next "right" ID value and run the following query, replacing "5" with whatever the real ID value is plus one (so, the next "empty" REAL number. If the highest actual ID in your DB is 30405, then you need to put 30406 here)

    alter table vb_user AUTO_INCREMENT = 5;
    Obviously if you have a different table prefix, you'll need to change that.

    That should do it. I recommend, of course, making a backup of your database prior to doing this in case anything goes wrong. If you need further help, I'll be happy to continue in this thread.
    Last edited by Kitebu; Tue 25 Sep '07, 6:08pm.


    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.