The MU forums have moved to WordPress.org

how to Get blog's database name when using Multi-DB (9 posts)

  1. kmaz
    Member
    Posted 15 years ago #

    Hi,

    I have an issue. I use Multi-Db to scale my database, I actually have 4096 databases and my blogs are dispatched through them all. My problem is that I need to access one of my blog's database through phpMyadmin but I can't find the db name.
    Dou you have an idea how to find that?
    Thanks

  2. tdjcbe
    Member
    Posted 15 years ago #

    I use Multi-Db to scale my database

    Which one? There's like 3 different solutions for multiple databases now. And I believe 2 of them handle the sorting of dbs one way and the third one does it differently.

  3. cafespain
    Member
    Posted 15 years ago #

    Yep, you need to check which you are using - two of them create an MD5 hash of the blogid and then depending on how many databases you are using, it makes a decimal value from the first 1-3 characters.

    Have a look in the settings php file for the plugin you are using and you will see a function that takes a blogid and returns a database number.

  4. andrewbillits
    Member
    Posted 15 years ago #

    Hiya,

    If you're using the Multi-DB plugin available at premium.wpmudev.org then you just take the md5 hash of the blog id an grab the first three characters of the hash.

    So for example the hash for the main blog (id = 1) is:
    c4ca4238a0b923820dcc509a6f75849b

    That blog is in the database PREFIX_c4c. For 256 databases you grab the first two characters and for 16 you just grab the first character.

    There are many places/ways to get the md5 hash of the blog ids but we have a simple little tool a few people use:
    http://calc.wpmudev.org/md5.php

    Thanks,
    Andrew

  5. kmaz
    Member
    Posted 15 years ago #

    Hi,

    Thanks a lot for your answers. Yes I use the Mutli DB from WPMUdev Premium. (working great by the way) I'll check that and tell you.

  6. kmaz
    Member
    Posted 15 years ago #

    Got it! Thanks a lot!

  7. kmaz
    Member
    Posted 15 years ago #

    Also I plan to upgrade my installation. I am running WPMU 1.3.3 and plan to upgrade to 1.5 and then to 2.6 or maybe 2.7. Do you think that because I run Multi DB i will run into some troubles? I have for now almost 5000 blogs dispatched through the 4096 db. Thanks.

  8. tdjcbe
    Member
    Posted 15 years ago #

    You may want to visit the forums at http://premium.wpmudev.org/forums as that's where support for that code is provided.

    There's a couple of threads already on the 2.7 upgrade.

  9. kmaz
    Member
    Posted 15 years ago #

    Thank you.

About this Topic