Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Manually reset user id to higher number?


Jeff Sayre
Participant

@jeffsayre

That would be wp_users, but isn’t that ID used as a key (?) elsewhere in the database? Would it get “altered” automatically throughout the system?

No, in WPMU DBs, changing the auto increment field, or any other linked field, does not automatically propagate the changes throughout. The technical term for what you are referring to is referential integrity, with the specific subset of that called cascading changes.

With the MySQL engine, cascading changes (update or delete) throughout the DB only can occur if the tables in the DB have been set up as type InnoDB and the appropriate foreign keys applied. WPMU’s tables are set up as type MyISAM. Before assuming that this was/is a bad choice, when it comes to MySQL, there are pros and cons with each table type. A conscious decision went into selecting MyISAM table types for WPMU’s DB.

Now, with regards to the specific issue you are facing:

Although all the tables in WPMU’s DB have an ID field that is set to auto_increment, the ID field in wp_users is used to assign a unique ID to each registered member of your site. That ID field ties into the other tables in the DB, where necessary, by mapping to an appropriate field–but not to the auto incremented ID field of the other tables.

So, for example, the wp_user ID field forms a relationship in the wp_bp_friends table in two places–with the initiator_user_id and friend_user_id fields. Or as a specific example, wp_user ID field = 7 would form a relationship with the field in wp_bp_xprofile_data where the value of its user_id field equaled 7.

You are on the verge of potentially causing a very big, possibly fatal problem for your MySQL DB. Before doing anything, back up your DB and be prepared for the very-real possibility that you are going to alter the table relationships (break them) to such a point that your DB will not function anymore. You will then have to delete all the data in the DB tables and then restore the data from your backup.

You might even find yourself in the position of having to actually delete the entire DB and creating a new one from scratch. You’ will then need to restore from the back up. So you should also make sure you have a copy of the DB settings in WPMU’s wp-config.php file as you will have to recreate the new DB exactly to match the settings found in that configuration file.

Skip to toolbar