Support » Networking WordPress » Which DB table is a user in?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The data for a blog is held in multiple tables; standard ones for posts, comments etc and possibly others created by plugins or themes activated for the blog.
    In WPMU 2.8.6, Go to Site Admin > Blogs and find the blog’s ID number. In a default install, the tables you need are those with the wp_<ID>_ prefix, e.g. wp_<ID>_posts.

    Thank you very much for the quick reply. I misspoke though, sorry. I meant, how do can I find which database a user’s tables are in?

    In my WPMU installation, the blogs are spread over 256 DBs. So how do I know which DB a particular blog resides in?

    Thanks again for your help 🙂


    The plugin you’re using is based on md5 hashes of the blog ID. So, for example, #1 is in db C if you have 16 (which I see you don’t).

    Thanks, Andrea. Could you please tell me how to calculate it?

    Funny you should use #1 as an example, since that’s the one (my own) that I’m interested in. I gather from your reply that the answer is different if I have 256 DBs.

    Yeah, but it still starts with a c. 🙂

    The people you bought the db plugin from also have a script/tut to determine this.

    ummmm… I’m not referring to any plugin. I’m just talking about default functionality of WPMU, before WP itself went multi. I got it from, I think. I thought that was pretty much the only one.

    Thanks for all the help, Andrea. You’re a goddess.

    In default wpmu, there is but one database. The users are in the wp_users table, normally, iirc, and for each blog, you have to sort out what blog number it is blah blah blah what dgilmour said. I don’t think the users table references the blogs a person has (it goes the other way, I believe) If your install is split across multiple db’s that’s a plugin and what Andrera said holds true.

    Aaaahhh… you guys are right. It’s been so long, I forgot. I was using the multi-db plugin. Found what I was looking for, and here it is if anyone else was looking:

    $hash_value = md5($blog_id);
    				if (DB_SCALING == '16'){
    					$dataset = substr($hash_value, 0, 1);
    				} else if (DB_SCALING == '256'){
    					$dataset = substr($hash_value, 0, 2);
    				} else if (DB_SCALING == '4096'){
    					$dataset = substr($hash_value, 0, 3);
    				} else {
    					$dataset = substr($hash_value, 0, 1);

    Yeah, there’s two more out there:

    I know Shard DB has a column to show which db a site is in.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Which DB table is a user in?’ is closed to new replies.