Multidb problem with clean installation

With WP3.0 i decided to start from scratch with multidb but for some reason, it's not working.

I followed the installation and everything seems be fine, move-blogs worked without a problem, copied tables to vip blog but when i wanted to verify that im using the multidb (renaming the old db) i got the "Can’t select database" message.

The only thing that i did different now is the name of the db, the old db is called wp and the new wp_0, wp_1, etc. could that be a problem ?

Last time that i installed it i dont remember modifying the wp-config file, do we have to do it now ?

  • kueyen
    • Flash Drive

    Sure, thanks :slight_smile:

    // Plugin Name: Multi-DB
    // Plugin URI:
    // Author: Andrew Billits (Incsub)
    // Version: 2.9.2
    //---DB Scaling-----------------------------------------------------------//
    // 16,256,4096
    define ('DB_SCALING', '16');
    //---DC IPs---------------------------------------------------------------//
    // Usage: add_dc_ip(IP, DC)
    // EX: add_dc_ip('123.123.123.', 'dc1');
    add_dc_ip('10.1.2.', 'dc1');
    //---Global Tables--------------------------------------------------------//
    // Do not include default global tables
    // Leave off base prefix (eg: wp_)
    // Usage: add_global_table(TABLE_NAME)
    // EX: add_global_table('something');

    //---DB Servers-----------------------------------------------------------//
    // Database servers grouped by dataset.
    // R can be 0 (no reads) or a positive integer indicating the order
    // in which to attempt communication (all locals, then all remotes)
    // Usage: add_db_server(DS, DC, READ, WRITE, HOST, LAN_HOST, NAME, USER, PASS)
    // EX: add_db_server('global', 'dc1', 1, 1,'','global.mysql.example.lan:3509', 'global-db', 'gl
    obaluser', 'globalpassword');
    // Note: you can also place this section in a file called db-list.php in wp-content
    add_db_server('global', 'dc1', 1, 1,'localhost','localhost', 'wp_global', 'user', 'password');

    add_db_server('0', 'dc1', 1, 1,'localhost','localhost', 'wp_0', 'user', 'password');
    add_db_server('1', 'dc1', 1, 1,'localhost','localhost', 'wp_1', 'user', 'password');
    add_db_server('2', 'dc1', 1, 1,'localhost','localhost', 'wp_2', 'user', 'password');
    add_db_server('3', 'dc1', 1, 1,'localhost','localhost', 'wp_3', 'user', 'password');
    add_db_server('4', 'dc1', 1, 1,'localhost','localhost', 'wp_4', 'user', 'password');
    add_db_server('5', 'dc1', 1, 1,'localhost','localhost', 'wp_5', 'user', 'password');
    add_db_server('6', 'dc1', 1, 1,'localhost','localhost', 'wp_6', 'user', 'password');
    add_db_server('7', 'dc1', 1, 1,'localhost','localhost', 'wp_7', 'user', 'password');
    add_db_server('8', 'dc1', 1, 1,'localhost','localhost', 'wp_8', 'user', 'password');
    add_db_server('9', 'dc1', 1, 1,'localhost','localhost', 'wp_9', 'user', 'password');
    add_db_server('a', 'dc1', 1, 1,'localhost','localhost', 'wp_a', 'user', 'password');
    add_db_server('b', 'dc1', 1, 1,'localhost','localhost', 'wp_b', 'user', 'password');
    add_db_server('c', 'dc1', 1, 1,'localhost','localhost', 'wp_c', 'user', 'password');
    add_db_server('d', 'dc1', 1, 1,'localhost','localhost', 'wp_d', 'user', 'password');
    add_db_server('e', 'dc1', 1, 1,'localhost','localhost', 'wp_e', 'user', 'password');
    add_db_server('f', 'dc1', 1, 1,'localhost','localhost', 'wp_f', 'user', 'password');

    add_db_server('vip1', 'dc1', 1, 1,'localhost','localhost', 'wp_vip1', 'user', 'password');
    //---VIP Blogs------------------------------------------------------------//
    // Usage: add_vip_user(BLOG_ID, DS)
    // EX: add_vip_user(1, 'vip1');

    add_vip_user(1, 'vip1');

  • Andrew
    • Champion of Loops


    Have you added anything to your vip db? I'd really suggest holding off on using the vip feature. It's rarely needed and only adds complexity. If you haven't added anything to the db yet just comment out these two lines:

    add_db_server('vip1', 'dc1', 1, 1,'localhost','localhost', 'wp_vip1', 'user', 'password');

    add_vip_user(1, 'vip1');


  • Andrew
    • Champion of Loops

    Yeh, let's move the main blog tables back to the other db.

    still getting the same error "Error establishing a database connection"

    You didn't mention that error before. Double check your db connection information (users, passwords, etc). Make sure that the user you're using has access to the databases.


  • kueyen
    • Flash Drive

    It's the same error than before but from the admin page and from the main page.

    I did it everything again, and everytime i try to remove the old db i got the cant connect message. I noticed that the other databases are getting filled and when i create a new user is created in wp_global rather than wp (the old one).... if it's actually using global instead of the old one, why i cant just remove it ?


  • drmike
    • DEV MAN’s Mascot

    VIPs aren't needed unless the blog in question is getting millions of hits a day and you have to put that blog's databases on a separate machine to deal with load.

    edit: Well thousands of comments a day at least. Millions of hits or page views really needs to be handled with a caching script.

    Friendly reminder that that clarification should be in the install instructions. :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.