It looked like the install of Multi - DB worked, but my sites are not showing up now....

I installed Multi-DB... Everything looked good until I tried to go to the sites. I get blank pages. h2hblogs.com a new site http://h2hblogs.com/test1 any ideas?

Thank you.

  • Michelle Shull

    Hi Karen!

    It looks like you may have missed a step in the setup process. Did you follow the usage guide and create a backup of your multisite before you started?

    There are many steps to the MultiDB process, and a number of them may have caused the issue you're seeing.

    What results did you see after you edited move_blogs.php and examined it in your browser? (http://yourdomain.com/wp-content/scripts/move-blogs.php)

    Did you ensure your host met all the requirements listed at the beginning of the usage guide?

    Did you follow each of the pre-installation steps for creating new databases?

    Thanks! Any extra info here can help us track down this issue faster.

  • karen_coghlan

    The move_blogs went as expected no errors everything looked good this is my third attempt.

    http://h2hblogs.com/wp-content/scripts/move-blogs.php

    I followed the usage guide, but did not create a backup, but that is not a problem I know how to re-install it.

    Actually when this happened the last time removing the plugin files fixed the problem, does that indicate anything concrete?

    My hosting company said I would have to manually add all my data bases... I decided to only add 16 :slight_smile:

    They also said that using multiple databases was unorthodox.

    db-config.php
    -------------
    <?php
    // Multi-DB plugin's database configuration file
    // Plugin URI https://premium.wpmudev.org/project/Multiple-Databases
    // 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('155.55.155.', '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');
    add_global_table('databasename_global');
    //------------------------------------------------------------------------//
    //---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.com:3509','global.mysql.example.lan:3509', 'global-db', 'globaluser', '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,'','155.55.155.15', 'databasename_global', 'gooduser_namehere', 'good password here');

    add_db_server('0', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_0', 'gooduser_namehere', 'good password here');
    add_db_server('1', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_1', 'gooduser_namehere', 'good password here');
    add_db_server('2', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_2', 'gooduser_namehere', 'good password here');
    add_db_server('3', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_3', 'gooduser_namehere', 'good password here');
    add_db_server('4', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_4', 'gooduser_namehere', 'good password here');
    add_db_server('5', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_5', 'gooduser_namehere', 'good password here');
    add_db_server('6', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_6', 'gooduser_namehere', 'good password here');
    add_db_server('7', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_7', 'gooduser_namehere', 'good password here');
    add_db_server('8', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_8', 'gooduser_namehere', 'good password here');
    add_db_server('9', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_9', 'gooduser_namehere', 'good password here');
    add_db_server('a', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_a', 'gooduser_namehere', 'good password here');
    add_db_server('b', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_b', 'gooduser_namehere', 'good password here');
    add_db_server('c', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_c', 'gooduser_namehere', 'good password here');
    add_db_server('d', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_d', 'gooduser_namehere', 'good password here');
    add_db_server('e', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_e', 'gooduser_namehere', 'good password here');
    add_db_server('f', 'dc1', 1, 1,'',' 155.55.155.15', ' databasename_f', 'gooduser_namehere', 'good password here');

    add_db_server('vip1', 'dc1', 1, 1,'','155.55.155.15','databasename_vip_1', 'gooduser_namehere', 'good password here');
    add_db_server('vip2', 'dc1', 1, 1,'','155.55.155.15','databasename_vip_1', 'gooduser_namehere', 'good password here');
    add_db_server('vip3', 'dc1', 1, 1,'','155.55.155.15','databasename_vip_1', 'gooduser_namehere', 'good password here');
    add_db_server('vip4', 'dc1', 1, 1,'','155.55.155.15','databasename_vip_1', 'gooduser_namehere', 'good password here');
    add_db_server('vip5', 'dc1', 1, 1,'','155.55.155.15','databasename_vip_1', 'gooduser_namehere', 'good password here');

    //------------------------------------------------------------------------//
    //---VIP Blogs------------------------------------------------------------//
    //------------------------------------------------------------------------//
    // Usage: add_vip_blog(BLOG_ID, DS)
    // EX: add_vip_blog(1, 'vip1');

    add_vip_blog(, 'vip1');
    add_vip_blog(, 'vip2');
    add_vip_blog(, 'vip3');
    add_vip_blog(, 'vip4');
    add_vip_blog(, 'vip5');

    ?>

    move-blogs.php
    --------------

    <?php

    /*
    Multi-DB plugin's database conversion tool
    Plugin URI https://premium.wpmudev.org/project/multi-db
    Version: 3.2
    Author: WPMU DEV
    Author URI: https://premium.wpmudev.org/
    Description: This script is to move blogs from a wordpress mu single database setup, to a wordpress mu multiple database setup using an MD5 hash to establish blog routing
    */

    //------------------------------------------------------------------------//
    //---Config---------------------------------------------------------------//
    //------------------------------------------------------------------------//

    ///DB Settings
    $dbname = "original_database"; //This is your current database
    $blog_table_prefix = 'wp_'; //Prefix of your wpmu blog tables, most likely this won't need to be changed
    $newdb_prefix = 'databasename_'; //This is the prefix of the db's you're moving your tables into - we assume they are all the same, if not, you're in trouble

    //We need info to connect to the databases
    $dbhost = 'localhost';
    $dbuname = 'gooduser_namehere'; this is the user for the original database (I used the same for old and new)
    $dbpass = 'good password here'; this is for the user of the original database (I used the same for old and new)

    //How many db's are you moving into (16, 256, or 4096)?
    $db_scaling = '16';

    //------------------------------------------------------------------------//
    //---Processing-----------------------------------------------------------//
    //------------------------------------------------------------------------//

    $newdbsize = '1';
    if ( $db_scaling == '256' ) {
    $newdbsize = '2';
    } else if ( $db_scaling == '4096' ) {
    $newdbsize = '3';
    }

    //Check to see if we are moving tables yet
    $tabletomove = $_REQUEST["table"];

    //Connect to SQL
    if ( !mysql_connect( $dbhost, $dbuname, $dbpass ) ) {
    echo 'Could not connect to mysql';
    exit;
    }

    //Get our table list from the original db
    $result = mysql_query( 'SHOW TABLES FROM ' . $dbname );
    if ( !$result ) {
    echo "DB Error, could not list tables<b>Make sure you configure your original table in the dbname variable at the top of the script!</b>";
    echo 'MySQL Error: ' . mysql_error();
    exit;
    }

    //------------------------------------------------------------------------//
    //---Table----------------------------------------------------------------//
    //------------------------------------------------------------------------//

    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Multiple Databases Conversion Tool</title>
    <style type="text/css">
    .centered { text-align: center; }
    table.stats { text-align: center; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif ; font-weight: normal;font-size: 12px;color:

    #fff;width: 750px;background-color: #666;border: 1px solid #555;border-collapse: collapse;border-spacing: 1px; }
    table.stats td { background-color: #CCC; color: #000; padding: 6px; text-align: left; border: 1px #fff solid; }
    table.stats td.head { background-color: #666; color: #fff; padding: 6px; text-align: center; border-bottom: 2px #fff solid; font-size: 12px; font-

    weight: bold; width: 25%; }
    </style>
    </head>
    <body>
    <table align="center" class="stats">
    <tr>
    <td colspan="4" align="center">

    1. Tested on PHP 5 & MySQL 5
    2. Make sure all of your new db's exist (green text next to table name in db column below)
    3. In the status section, each table should show <i>not in new db (unless you've already run this script)</i>
    4. To start the copy process click here
    5. Be patient, depending on how many blogs you have, this could take a while
    6. Once completed, refresh this page by clicking here
    7. Check to make sure that in the status section all tables say <i>table in new db</i>
    8. Rejoice, I probably just saved you hours of your life!
    9. If this didn't work, don't blame me. Sometimes life is just like that..

    </td>
    </tr>
    <tr>
    <td class="head">table name</td>
    <td class="head">table info</td>
    <td class="head">new db</td>
    <td class="head">status</td>
    </tr><?php

    $blog_table_prefix_len = strlen( $blog_table_prefix );
    while ( $row = mysql_fetch_row( $result ) ) {
    if ( substr( $row[0], 0, $blog_table_prefix_len ) != $blog_table_prefix ) {
    continue;
    }

    //Here we find our blog id, hash it, and establish our new db names
    $blogid = current( explode( "_", substr( $row[0], $blog_table_prefix_len ) ) );
    $this_blog_new_db = is_numeric( $blogid )
    ? $newdb_prefix . substr( md5( $blogid ), 0, $newdbsize )
    : $newdb_prefix . "global";

    $db = mysql_connect( $dbhost, $dbuname, $dbpass ) or die( "Houston, we have a problem!Database Error: " . mysql_error() );
    mysql_select_db( $this_blog_new_db, $db ) or die( "Houston, we have a problem!<b>Looks like you need to create your new db's! If you're

    lucky, this link still works - click me </b>Database Error: " . mysql_error() );

    $tableexists = mysql_num_rows( mysql_query( "SHOW TABLES LIKE '{$row[0]}'" ) );
    $tabletest = $tableexists
    ? '<span style="color:green">table in new db</span>'
    : "table not in new db";

    //Next we check to see if we are actually moving anything yet
    if ( !empty( $tabletomove ) && !$tableexists ) {
    mysql_query( "CREATE TABLE {$row[0]} LIKE {$dbname}.{$row[0]}" );
    mysql_query( "INSERT INTO {$row[0]} SELECT * FROM {$dbname}.{$row[0]}" );
    }

    $testpass = '<span style="color:green"> exists</span>';
    echo "<tr><td>{$row[0]}</td><td>";
    echo is_numeric( $blogid ) ? 'blog ' . $blogid : 'global';
    echo "</td><td>{$this_blog_new_db} <i>{$testpass}</i></td><td>{$tabletest}</td></tr>";

    mysql_close( $db );
    } // end while

    ?></table>
    </body>
    </html>

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.