MyBB Community Forums

Full Version: Possible to reset UID's
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So long story short
my UID's are all mixed up
and Id like to know if mybb has a feature or a plugin
where I can re account UID's
as I have 60 members but they are at UID 200
Wouldn't advise it.
(2019-11-10, 05:49 AM)Ben Cousins Wrote: [ -> ]Wouldn't advise it.

would it be better to reset?
Honestly, uids mean nothing except to link posts and threads and such to a user in the backend, I wouldn't worry about them
You'll enter into a world of pain trying to always have the IDs sequential. It's an arbitrary auto-incrementing number generated by the database for every new row added to a table, which is used to identify it and link it to other data. The same thing will happen every time you delete a post or thread, and the IDs are used all over the place, so you'll likely end up with mismatched data if you try and reset them (i.e. if you had posts by UID 10, and reset the UIDs to start at 5, then when it gets to create user ID 10 again, they would have someone else's posts attributed to them). You'll only screw up your data trying to do this.
(2019-11-10, 07:05 PM)Matt Wrote: [ -> ]You'll enter into a world of pain trying to always have the IDs sequential. It's an arbitrary auto-incrementing number generated by the database for every new row added to a table, which is used to identify it and link it to other data. The same thing will happen every time you delete a post or thread, and the IDs are used all over the place, so you'll likely end up with mismatched data if you try and reset them (i.e. if you had posts by UID 10, and reset the UIDs to start at 5, then when it gets to create user ID 10 again, they would have someone else's posts attributed to them). You'll only screw up your data trying to do this.

gotcha Ill just hide UID's then
I also have this error
[Image: image0.png?width=326&height=706]

Users are allowed 1 char names but in ref they cant seem to find it

https://media.discordapp.net/attachments...height=706
(2019-11-10, 07:05 PM)Matt Wrote: [ -> ]You'll enter into a world of pain trying to always have the IDs sequential. It's an arbitrary auto-incrementing number generated by the database for every new row added to a table, which is used to identify it and link it to other data. The same thing will happen every time you delete a post or thread, and the IDs are used all over the place, so you'll likely end up with mismatched data if you try and reset them (i.e. if you had posts by UID 10, and reset the UIDs to start at 5, then when it gets to create user ID 10 again, they would have someone else's posts attributed to them). You'll only screw up your data trying to do this.

Would this work

SELECT * FROM `DBPREFIX_users` ORDER BY `uid` ASC;

SET @count = 40000000;
UPDATE `DBPREFIX_users` SET `uid` = @count:= @count + 1;

SET @count = 0;
UPDATE `DBPREFIX_users` SET `uid` = @count:= @count + 1;

ALTER TABLE `DBPREFIX_users` AUTO_INCREMENT = 1;
Again, I would strongly advise against you doing this.

Also this line:

ALTER TABLE `DBPREFIX_users` AUTO_INCREMENT = 1;

Won’t work. As that’ll set the Auto Increment value to the literal numeral 1, which you don’t want.