Fail to implement Multi-DB, Site not really created

Hi

Last night i try to use multi-db.
I installing fresh new server using ubuntu 14.04
Than i installing nginx using easyengine and also test it with apache2.
Wordpress latest version with subdirectory configuration.

When i implement multi-db, everything is look find.
Script move-blogs.php also look good.

But when i try to create a new site, something weird start happening.
Every site i create is actually go to the main site.

Let said, a main site is main.com
So in a site list i create beta.main.com
When i want to go to dashboard of beta, it going to main.com, the link in site list still said there is beta there. But i i mouse over to dashboard link, it look like a link go to main.com.

I try to change also in wp-config.php to poin my database to main-global with same condition when i create a new site. So i can not delete a site since it not actually exist.

I try to examine an error log that it said, a database is never created.
Something such this error tell me that a table in database not created.
I examine a database and see there is no table there.

WordPress database error Table 'main_e4.wp_5_options' doesn't exist for query SELECT option_value FROM wp_5_options WHERE option_name = 'upload_url_path' LIMIT 1 made by wpmu_delete_blog, wp_upload_dir, get_option, m_wpdb->query,

So any one can help me to solve this ?

Regards

  • mprasodjo

    db-config.php

    <?php
    //------------------------------------------------------------------------//
    //---DB Scaling-----------------------------------------------------------//
    //------------------------------------------------------------------------//
    // 16,256,4096
    define ('DB_SCALING', '256');

    //------------------------------------------------------------------------//
    //---DC IPs---------------------------------------------------------------//
    //------------------------------------------------------------------------//
    // Usage: add_dc_ip(IP, DC)
    // EX: add_dc_ip('123.123.123.', 'dc1');
    add_dc_ip('127.0.0.', 'dc1');

    //------------------------------------------------------------------------//
    //---Global Tables--------------------------------------------------------//
    //------------------------------------------------------------------------//
    // Do not include default global tables
    // Leave off base prefix (eg: wp_)
    // You don't really have to register these, they will work fine without.
    // However registering at least your busiest ones might shave a few milliseconds off by avoiding some regexes.
    //
    // Usage: add_global_table(TABLE_NAME)
    // EX: add_global_table('something');
    add_global_table('main_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,'127.0.0.1','127.0.0.1', 'main_global', 'user', 'PASSWORD');

    add_db_server('00', 'dc1', 1, 1,'','127.0.0.1', 'main_00', 'user', 'PASSWORD');
    add_db_server('01', 'dc1', 1, 1,'','127.0.0.1', 'main_01', 'user', 'PASSWORD');
    add_db_server('02', 'dc1', 1, 1,'','127.0.0.1', 'main_02', 'user', 'PASSWORD');
    add_db_server('03', 'dc1', 1, 1,'','127.0.0.1', 'main_03', 'user', 'PASSWORD');
    add_db_server('04', 'dc1', 1, 1,'','127.0.0.1', 'main_04', 'user', 'PASSWORD');
    add_db_server('05', 'dc1', 1, 1,'','127.0.0.1', 'main_05', 'user', 'PASSWORD');
    add_db_server('06', 'dc1', 1, 1,'','127.0.0.1', 'main_06', 'user', 'PASSWORD');
    add_db_server('07', 'dc1', 1, 1,'','127.0.0.1', 'main_07', 'user', 'PASSWORD');
    add_db_server('08', 'dc1', 1, 1,'','127.0.0.1', 'main_08', 'user', 'PASSWORD');
    add_db_server('09', 'dc1', 1, 1,'','127.0.0.1', 'main_09', 'user', 'PASSWORD');
    add_db_server('0a', 'dc1', 1, 1,'','127.0.0.1', 'main_0a', 'user', 'PASSWORD');
    add_db_server('0b', 'dc1', 1, 1,'','127.0.0.1', 'main_0b', 'user', 'PASSWORD');
    add_db_server('0c', 'dc1', 1, 1,'','127.0.0.1', 'main_0c', 'user', 'PASSWORD');
    add_db_server('0d', 'dc1', 1, 1,'','127.0.0.1', 'main_0d', 'user', 'PASSWORD');
    add_db_server('0e', 'dc1', 1, 1,'','127.0.0.1', 'main_0e', 'user', 'PASSWORD');
    add_db_server('0f', 'dc1', 1, 1,'','127.0.0.1', 'main_0f', 'user', 'PASSWORD');
    add_db_server('10', 'dc1', 1, 1,'','127.0.0.1', 'main_10', 'user', 'PASSWORD');
    add_db_server('11', 'dc1', 1, 1,'','127.0.0.1', 'main_11', 'user', 'PASSWORD');
    add_db_server('12', 'dc1', 1, 1,'','127.0.0.1', 'main_12', 'user', 'PASSWORD');
    add_db_server('13', 'dc1', 1, 1,'','127.0.0.1', 'main_13', 'user', 'PASSWORD');
    add_db_server('14', 'dc1', 1, 1,'','127.0.0.1', 'main_14', 'user', 'PASSWORD');
    add_db_server('15', 'dc1', 1, 1,'','127.0.0.1', 'main_15', 'user', 'PASSWORD');
    add_db_server('16', 'dc1', 1, 1,'','127.0.0.1', 'main_16', 'user', 'PASSWORD');
    add_db_server('17', 'dc1', 1, 1,'','127.0.0.1', 'main_17', 'user', 'PASSWORD');
    add_db_server('18', 'dc1', 1, 1,'','127.0.0.1', 'main_18', 'user', 'PASSWORD');
    add_db_server('19', 'dc1', 1, 1,'','127.0.0.1', 'main_19', 'user', 'PASSWORD');
    add_db_server('1a', 'dc1', 1, 1,'','127.0.0.1', 'main_1a', 'user', 'PASSWORD');
    add_db_server('1b', 'dc1', 1, 1,'','127.0.0.1', 'main_1b', 'user', 'PASSWORD');
    add_db_server('1c', 'dc1', 1, 1,'','127.0.0.1', 'main_1c', 'user', 'PASSWORD');
    add_db_server('1d', 'dc1', 1, 1,'','127.0.0.1', 'main_1d', 'user', 'PASSWORD');
    add_db_server('1e', 'dc1', 1, 1,'','127.0.0.1', 'main_1e', 'user', 'PASSWORD');
    add_db_server('1f', 'dc1', 1, 1,'','127.0.0.1', 'main_1f', 'user', 'PASSWORD');
    add_db_server('20', 'dc1', 1, 1,'','127.0.0.1', 'main_20', 'user', 'PASSWORD');
    add_db_server('21', 'dc1', 1, 1,'','127.0.0.1', 'main_21', 'user', 'PASSWORD');
    add_db_server('22', 'dc1', 1, 1,'','127.0.0.1', 'main_22', 'user', 'PASSWORD');
    add_db_server('23', 'dc1', 1, 1,'','127.0.0.1', 'main_23', 'user', 'PASSWORD');
    add_db_server('24', 'dc1', 1, 1,'','127.0.0.1', 'main_24', 'user', 'PASSWORD');
    add_db_server('25', 'dc1', 1, 1,'','127.0.0.1', 'main_25', 'user', 'PASSWORD');
    add_db_server('26', 'dc1', 1, 1,'','127.0.0.1', 'main_26', 'user', 'PASSWORD');
    add_db_server('27', 'dc1', 1, 1,'','127.0.0.1', 'main_27', 'user', 'PASSWORD');
    add_db_server('28', 'dc1', 1, 1,'','127.0.0.1', 'main_28', 'user', 'PASSWORD');
    add_db_server('29', 'dc1', 1, 1,'','127.0.0.1', 'main_29', 'user', 'PASSWORD');
    add_db_server('2a', 'dc1', 1, 1,'','127.0.0.1', 'main_2a', 'user', 'PASSWORD');
    add_db_server('2b', 'dc1', 1, 1,'','127.0.0.1', 'main_2b', 'user', 'PASSWORD');
    add_db_server('2c', 'dc1', 1, 1,'','127.0.0.1', 'main_2c', 'user', 'PASSWORD');
    add_db_server('2d', 'dc1', 1, 1,'','127.0.0.1', 'main_2d', 'user', 'PASSWORD');
    add_db_server('2e', 'dc1', 1, 1,'','127.0.0.1', 'main_2e', 'user', 'PASSWORD');
    add_db_server('2f', 'dc1', 1, 1,'','127.0.0.1', 'main_2f', 'user', 'PASSWORD');
    add_db_server('30', 'dc1', 1, 1,'','127.0.0.1', 'main_30', 'user', 'PASSWORD');
    add_db_server('31', 'dc1', 1, 1,'','127.0.0.1', 'main_31', 'user', 'PASSWORD');
    add_db_server('32', 'dc1', 1, 1,'','127.0.0.1', 'main_32', 'user', 'PASSWORD');
    add_db_server('33', 'dc1', 1, 1,'','127.0.0.1', 'main_33', 'user', 'PASSWORD');
    add_db_server('34', 'dc1', 1, 1,'','127.0.0.1', 'main_34', 'user', 'PASSWORD');
    add_db_server('35', 'dc1', 1, 1,'','127.0.0.1', 'main_35', 'user', 'PASSWORD');
    add_db_server('36', 'dc1', 1, 1,'','127.0.0.1', 'main_36', 'user', 'PASSWORD');
    add_db_server('37', 'dc1', 1, 1,'','127.0.0.1', 'main_37', 'user', 'PASSWORD');
    add_db_server('38', 'dc1', 1, 1,'','127.0.0.1', 'main_38', 'user', 'PASSWORD');
    add_db_server('39', 'dc1', 1, 1,'','127.0.0.1', 'main_39', 'user', 'PASSWORD');
    add_db_server('3a', 'dc1', 1, 1,'','127.0.0.1', 'main_3a', 'user', 'PASSWORD');
    add_db_server('3b', 'dc1', 1, 1,'','127.0.0.1', 'main_3b', 'user', 'PASSWORD');
    add_db_server('3c', 'dc1', 1, 1,'','127.0.0.1', 'main_3c', 'user', 'PASSWORD');
    add_db_server('3d', 'dc1', 1, 1,'','127.0.0.1', 'main_3d', 'user', 'PASSWORD');
    add_db_server('3e', 'dc1', 1, 1,'','127.0.0.1', 'main_3e', 'user', 'PASSWORD');
    add_db_server('3f', 'dc1', 1, 1,'','127.0.0.1', 'main_3f', 'user', 'PASSWORD');
    add_db_server('40', 'dc1', 1, 1,'','127.0.0.1', 'main_40', 'user', 'PASSWORD');
    add_db_server('41', 'dc1', 1, 1,'','127.0.0.1', 'main_41', 'user', 'PASSWORD');
    add_db_server('42', 'dc1', 1, 1,'','127.0.0.1', 'main_42', 'user', 'PASSWORD');
    add_db_server('43', 'dc1', 1, 1,'','127.0.0.1', 'main_43', 'user', 'PASSWORD');
    add_db_server('44', 'dc1', 1, 1,'','127.0.0.1', 'main_44', 'user', 'PASSWORD');
    add_db_server('45', 'dc1', 1, 1,'','127.0.0.1', 'main_45', 'user', 'PASSWORD');
    add_db_server('46', 'dc1', 1, 1,'','127.0.0.1', 'main_46', 'user', 'PASSWORD');
    add_db_server('47', 'dc1', 1, 1,'','127.0.0.1', 'main_47', 'user', 'PASSWORD');
    add_db_server('48', 'dc1', 1, 1,'','127.0.0.1', 'main_48', 'user', 'PASSWORD');
    add_db_server('49', 'dc1', 1, 1,'','127.0.0.1', 'main_49', 'user', 'PASSWORD');
    add_db_server('4a', 'dc1', 1, 1,'','127.0.0.1', 'main_4a', 'user', 'PASSWORD');
    add_db_server('4b', 'dc1', 1, 1,'','127.0.0.1', 'main_4b', 'user', 'PASSWORD');
    add_db_server('4c', 'dc1', 1, 1,'','127.0.0.1', 'main_4c', 'user', 'PASSWORD');
    add_db_server('4d', 'dc1', 1, 1,'','127.0.0.1', 'main_4d', 'user', 'PASSWORD');
    add_db_server('4e', 'dc1', 1, 1,'','127.0.0.1', 'main_4e', 'user', 'PASSWORD');
    add_db_server('4f', 'dc1', 1, 1,'','127.0.0.1', 'main_4f', 'user', 'PASSWORD');
    add_db_server('50', 'dc1', 1, 1,'','127.0.0.1', 'main_50', 'user', 'PASSWORD');
    add_db_server('51', 'dc1', 1, 1,'','127.0.0.1', 'main_51', 'user', 'PASSWORD');
    add_db_server('52', 'dc1', 1, 1,'','127.0.0.1', 'main_52', 'user', 'PASSWORD');
    add_db_server('53', 'dc1', 1, 1,'','127.0.0.1', 'main_53', 'user', 'PASSWORD');
    add_db_server('54', 'dc1', 1, 1,'','127.0.0.1', 'main_54', 'user', 'PASSWORD');
    add_db_server('55', 'dc1', 1, 1,'','127.0.0.1', 'main_55', 'user', 'PASSWORD');
    add_db_server('56', 'dc1', 1, 1,'','127.0.0.1', 'main_56', 'user', 'PASSWORD');
    add_db_server('57', 'dc1', 1, 1,'','127.0.0.1', 'main_57', 'user', 'PASSWORD');
    add_db_server('58', 'dc1', 1, 1,'','127.0.0.1', 'main_58', 'user', 'PASSWORD');
    add_db_server('59', 'dc1', 1, 1,'','127.0.0.1', 'main_59', 'user', 'PASSWORD');
    add_db_server('5a', 'dc1', 1, 1,'','127.0.0.1', 'main_5a', 'user', 'PASSWORD');
    add_db_server('5b', 'dc1', 1, 1,'','127.0.0.1', 'main_5b', 'user', 'PASSWORD');
    add_db_server('5c', 'dc1', 1, 1,'','127.0.0.1', 'main_5c', 'user', 'PASSWORD');
    add_db_server('5d', 'dc1', 1, 1,'','127.0.0.1', 'main_5d', 'user', 'PASSWORD');
    add_db_server('5e', 'dc1', 1, 1,'','127.0.0.1', 'main_5e', 'user', 'PASSWORD');
    add_db_server('5f', 'dc1', 1, 1,'','127.0.0.1', 'main_5f', 'user', 'PASSWORD');
    add_db_server('60', 'dc1', 1, 1,'','127.0.0.1', 'main_60', 'user', 'PASSWORD');
    add_db_server('61', 'dc1', 1, 1,'','127.0.0.1', 'main_61', 'user', 'PASSWORD');
    add_db_server('62', 'dc1', 1, 1,'','127.0.0.1', 'main_62', 'user', 'PASSWORD');
    add_db_server('63', 'dc1', 1, 1,'','127.0.0.1', 'main_63', 'user', 'PASSWORD');
    add_db_server('64', 'dc1', 1, 1,'','127.0.0.1', 'main_64', 'user', 'PASSWORD');
    add_db_server('65', 'dc1', 1, 1,'','127.0.0.1', 'main_65', 'user', 'PASSWORD');
    add_db_server('66', 'dc1', 1, 1,'','127.0.0.1', 'main_66', 'user', 'PASSWORD');
    add_db_server('67', 'dc1', 1, 1,'','127.0.0.1', 'main_67', 'user', 'PASSWORD');
    add_db_server('68', 'dc1', 1, 1,'','127.0.0.1', 'main_68', 'user', 'PASSWORD');
    add_db_server('69', 'dc1', 1, 1,'','127.0.0.1', 'main_69', 'user', 'PASSWORD');
    add_db_server('6a', 'dc1', 1, 1,'','127.0.0.1', 'main_6a', 'user', 'PASSWORD');
    add_db_server('6b', 'dc1', 1, 1,'','127.0.0.1', 'main_6b', 'user', 'PASSWORD');
    add_db_server('6c', 'dc1', 1, 1,'','127.0.0.1', 'main_6c', 'user', 'PASSWORD');
    add_db_server('6d', 'dc1', 1, 1,'','127.0.0.1', 'main_6d', 'user', 'PASSWORD');
    add_db_server('6e', 'dc1', 1, 1,'','127.0.0.1', 'main_6e', 'user', 'PASSWORD');
    add_db_server('6f', 'dc1', 1, 1,'','127.0.0.1', 'main_6f', 'user', 'PASSWORD');
    add_db_server('70', 'dc1', 1, 1,'','127.0.0.1', 'main_70', 'user', 'PASSWORD');
    add_db_server('71', 'dc1', 1, 1,'','127.0.0.1', 'main_71', 'user', 'PASSWORD');
    add_db_server('72', 'dc1', 1, 1,'','127.0.0.1', 'main_72', 'user', 'PASSWORD');
    add_db_server('73', 'dc1', 1, 1,'','127.0.0.1', 'main_73', 'user', 'PASSWORD');
    add_db_server('74', 'dc1', 1, 1,'','127.0.0.1', 'main_74', 'user', 'PASSWORD');
    add_db_server('75', 'dc1', 1, 1,'','127.0.0.1', 'main_75', 'user', 'PASSWORD');
    add_db_server('76', 'dc1', 1, 1,'','127.0.0.1', 'main_76', 'user', 'PASSWORD');
    add_db_server('77', 'dc1', 1, 1,'','127.0.0.1', 'main_77', 'user', 'PASSWORD');
    add_db_server('78', 'dc1', 1, 1,'','127.0.0.1', 'main_78', 'user', 'PASSWORD');
    add_db_server('79', 'dc1', 1, 1,'','127.0.0.1', 'main_79', 'user', 'PASSWORD');
    add_db_server('7a', 'dc1', 1, 1,'','127.0.0.1', 'main_7a', 'user', 'PASSWORD');
    add_db_server('7b', 'dc1', 1, 1,'','127.0.0.1', 'main_7b', 'user', 'PASSWORD');
    add_db_server('7c', 'dc1', 1, 1,'','127.0.0.1', 'main_7c', 'user', 'PASSWORD');
    add_db_server('7d', 'dc1', 1, 1,'','127.0.0.1', 'main_7d', 'user', 'PASSWORD');
    add_db_server('7e', 'dc1', 1, 1,'','127.0.0.1', 'main_7e', 'user', 'PASSWORD');
    add_db_server('7f', 'dc1', 1, 1,'','127.0.0.1', 'main_7f', 'user', 'PASSWORD');
    add_db_server('80', 'dc1', 1, 1,'','127.0.0.1', 'main_80', 'user', 'PASSWORD');
    add_db_server('81', 'dc1', 1, 1,'','127.0.0.1', 'main_81', 'user', 'PASSWORD');
    add_db_server('82', 'dc1', 1, 1,'','127.0.0.1', 'main_82', 'user', 'PASSWORD');
    add_db_server('83', 'dc1', 1, 1,'','127.0.0.1', 'main_83', 'user', 'PASSWORD');
    add_db_server('84', 'dc1', 1, 1,'','127.0.0.1', 'main_84', 'user', 'PASSWORD');
    add_db_server('85', 'dc1', 1, 1,'','127.0.0.1', 'main_85', 'user', 'PASSWORD');
    add_db_server('86', 'dc1', 1, 1,'','127.0.0.1', 'main_86', 'user', 'PASSWORD');
    add_db_server('87', 'dc1', 1, 1,'','127.0.0.1', 'main_87', 'user', 'PASSWORD');
    add_db_server('88', 'dc1', 1, 1,'','127.0.0.1', 'main_88', 'user', 'PASSWORD');
    add_db_server('89', 'dc1', 1, 1,'','127.0.0.1', 'main_89', 'user', 'PASSWORD');
    add_db_server('8a', 'dc1', 1, 1,'','127.0.0.1', 'main_8a', 'user', 'PASSWORD');
    add_db_server('8b', 'dc1', 1, 1,'','127.0.0.1', 'main_8b', 'user', 'PASSWORD');
    add_db_server('8c', 'dc1', 1, 1,'','127.0.0.1', 'main_8c', 'user', 'PASSWORD');
    add_db_server('8d', 'dc1', 1, 1,'','127.0.0.1', 'main_8d', 'user', 'PASSWORD');
    add_db_server('8e', 'dc1', 1, 1,'','127.0.0.1', 'main_8e', 'user', 'PASSWORD');
    add_db_server('8f', 'dc1', 1, 1,'','127.0.0.1', 'main_8f', 'user', 'PASSWORD');
    add_db_server('90', 'dc1', 1, 1,'','127.0.0.1', 'main_90', 'user', 'PASSWORD');
    add_db_server('91', 'dc1', 1, 1,'','127.0.0.1', 'main_91', 'user', 'PASSWORD');
    add_db_server('92', 'dc1', 1, 1,'','127.0.0.1', 'main_92', 'user', 'PASSWORD');
    add_db_server('93', 'dc1', 1, 1,'','127.0.0.1', 'main_93', 'user', 'PASSWORD');
    add_db_server('94', 'dc1', 1, 1,'','127.0.0.1', 'main_94', 'user', 'PASSWORD');
    add_db_server('95', 'dc1', 1, 1,'','127.0.0.1', 'main_95', 'user', 'PASSWORD');
    add_db_server('96', 'dc1', 1, 1,'','127.0.0.1', 'main_96', 'user', 'PASSWORD');
    add_db_server('97', 'dc1', 1, 1,'','127.0.0.1', 'main_97', 'user', 'PASSWORD');
    add_db_server('98', 'dc1', 1, 1,'','127.0.0.1', 'main_98', 'user', 'PASSWORD');
    add_db_server('99', 'dc1', 1, 1,'','127.0.0.1', 'main_99', 'user', 'PASSWORD');
    add_db_server('9a', 'dc1', 1, 1,'','127.0.0.1', 'main_9a', 'user', 'PASSWORD');
    add_db_server('9b', 'dc1', 1, 1,'','127.0.0.1', 'main_9b', 'user', 'PASSWORD');
    add_db_server('9c', 'dc1', 1, 1,'','127.0.0.1', 'main_9c', 'user', 'PASSWORD');
    add_db_server('9d', 'dc1', 1, 1,'','127.0.0.1', 'main_9d', 'user', 'PASSWORD');
    add_db_server('9e', 'dc1', 1, 1,'','127.0.0.1', 'main_9e', 'user', 'PASSWORD');
    add_db_server('9f', 'dc1', 1, 1,'','127.0.0.1', 'main_9f', 'user', 'PASSWORD');
    add_db_server('a0', 'dc1', 1, 1,'','127.0.0.1', 'main_a0', 'user', 'PASSWORD');
    add_db_server('a1', 'dc1', 1, 1,'','127.0.0.1', 'main_a1', 'user', 'PASSWORD');
    add_db_server('a2', 'dc1', 1, 1,'','127.0.0.1', 'main_a2', 'user', 'PASSWORD');
    add_db_server('a3', 'dc1', 1, 1,'','127.0.0.1', 'main_a3', 'user', 'PASSWORD');
    add_db_server('a4', 'dc1', 1, 1,'','127.0.0.1', 'main_a4', 'user', 'PASSWORD');
    add_db_server('a5', 'dc1', 1, 1,'','127.0.0.1', 'main_a5', 'user', 'PASSWORD');
    add_db_server('a6', 'dc1', 1, 1,'','127.0.0.1', 'main_a6', 'user', 'PASSWORD');
    add_db_server('a7', 'dc1', 1, 1,'','127.0.0.1', 'main_a7', 'user', 'PASSWORD');
    add_db_server('a8', 'dc1', 1, 1,'','127.0.0.1', 'main_a8', 'user', 'PASSWORD');
    add_db_server('a9', 'dc1', 1, 1,'','127.0.0.1', 'main_a9', 'user', 'PASSWORD');
    add_db_server('aa', 'dc1', 1, 1,'','127.0.0.1', 'main_aa', 'user', 'PASSWORD');
    add_db_server('ab', 'dc1', 1, 1,'','127.0.0.1', 'main_ab', 'user', 'PASSWORD');
    add_db_server('ac', 'dc1', 1, 1,'','127.0.0.1', 'main_ac', 'user', 'PASSWORD');
    add_db_server('ad', 'dc1', 1, 1,'','127.0.0.1', 'main_ad', 'user', 'PASSWORD');
    add_db_server('ae', 'dc1', 1, 1,'','127.0.0.1', 'main_ae', 'user', 'PASSWORD');
    add_db_server('af', 'dc1', 1, 1,'','127.0.0.1', 'main_af', 'user', 'PASSWORD');
    add_db_server('b0', 'dc1', 1, 1,'','127.0.0.1', 'main_b0', 'user', 'PASSWORD');
    add_db_server('b1', 'dc1', 1, 1,'','127.0.0.1', 'main_b1', 'user', 'PASSWORD');
    add_db_server('b2', 'dc1', 1, 1,'','127.0.0.1', 'main_b2', 'user', 'PASSWORD');
    add_db_server('b3', 'dc1', 1, 1,'','127.0.0.1', 'main_b3', 'user', 'PASSWORD');
    add_db_server('b4', 'dc1', 1, 1,'','127.0.0.1', 'main_b4', 'user', 'PASSWORD');
    add_db_server('b5', 'dc1', 1, 1,'','127.0.0.1', 'main_b5', 'user', 'PASSWORD');
    add_db_server('b6', 'dc1', 1, 1,'','127.0.0.1', 'main_b6', 'user', 'PASSWORD');
    add_db_server('b7', 'dc1', 1, 1,'','127.0.0.1', 'main_b7', 'user', 'PASSWORD');
    add_db_server('b8', 'dc1', 1, 1,'','127.0.0.1', 'main_b8', 'user', 'PASSWORD');
    add_db_server('b9', 'dc1', 1, 1,'','127.0.0.1', 'main_b9', 'user', 'PASSWORD');
    add_db_server('ba', 'dc1', 1, 1,'','127.0.0.1', 'main_ba', 'user', 'PASSWORD');
    add_db_server('bb', 'dc1', 1, 1,'','127.0.0.1', 'main_bb', 'user', 'PASSWORD');
    add_db_server('bc', 'dc1', 1, 1,'','127.0.0.1', 'main_bc', 'user', 'PASSWORD');
    add_db_server('bd', 'dc1', 1, 1,'','127.0.0.1', 'main_bd', 'user', 'PASSWORD');
    add_db_server('be', 'dc1', 1, 1,'','127.0.0.1', 'main_be', 'user', 'PASSWORD');
    add_db_server('bf', 'dc1', 1, 1,'','127.0.0.1', 'main_bf', 'user', 'PASSWORD');
    add_db_server('c0', 'dc1', 1, 1,'','127.0.0.1', 'main_c0', 'user', 'PASSWORD');
    add_db_server('c1', 'dc1', 1, 1,'','127.0.0.1', 'main_c1', 'user', 'PASSWORD');
    add_db_server('c2', 'dc1', 1, 1,'','127.0.0.1', 'main_c2', 'user', 'PASSWORD');
    add_db_server('c3', 'dc1', 1, 1,'','127.0.0.1', 'main_c3', 'user', 'PASSWORD');
    add_db_server('c4', 'dc1', 1, 1,'','127.0.0.1', 'main_c4', 'user', 'PASSWORD');
    add_db_server('c5', 'dc1', 1, 1,'','127.0.0.1', 'main_c5', 'user', 'PASSWORD');
    add_db_server('c6', 'dc1', 1, 1,'','127.0.0.1', 'main_c6', 'user', 'PASSWORD');
    add_db_server('c7', 'dc1', 1, 1,'','127.0.0.1', 'main_c7', 'user', 'PASSWORD');
    add_db_server('c8', 'dc1', 1, 1,'','127.0.0.1', 'main_c8', 'user', 'PASSWORD');
    add_db_server('c9', 'dc1', 1, 1,'','127.0.0.1', 'main_c9', 'user', 'PASSWORD');
    add_db_server('ca', 'dc1', 1, 1,'','127.0.0.1', 'main_ca', 'user', 'PASSWORD');
    add_db_server('cb', 'dc1', 1, 1,'','127.0.0.1', 'main_cb', 'user', 'PASSWORD');
    add_db_server('cc', 'dc1', 1, 1,'','127.0.0.1', 'main_cc', 'user', 'PASSWORD');
    add_db_server('cd', 'dc1', 1, 1,'','127.0.0.1', 'main_cd', 'user', 'PASSWORD');
    add_db_server('ce', 'dc1', 1, 1,'','127.0.0.1', 'main_ce', 'user', 'PASSWORD');
    add_db_server('cf', 'dc1', 1, 1,'','127.0.0.1', 'main_cf', 'user', 'PASSWORD');
    add_db_server('d0', 'dc1', 1, 1,'','127.0.0.1', 'main_d0', 'user', 'PASSWORD');
    add_db_server('d1', 'dc1', 1, 1,'','127.0.0.1', 'main_d1', 'user', 'PASSWORD');
    add_db_server('d2', 'dc1', 1, 1,'','127.0.0.1', 'main_d2', 'user', 'PASSWORD');
    add_db_server('d3', 'dc1', 1, 1,'','127.0.0.1', 'main_d3', 'user', 'PASSWORD');
    add_db_server('d4', 'dc1', 1, 1,'','127.0.0.1', 'main_d4', 'user', 'PASSWORD');
    add_db_server('d5', 'dc1', 1, 1,'','127.0.0.1', 'main_d5', 'user', 'PASSWORD');
    add_db_server('d6', 'dc1', 1, 1,'','127.0.0.1', 'main_d6', 'user', 'PASSWORD');
    add_db_server('d7', 'dc1', 1, 1,'','127.0.0.1', 'main_d7', 'user', 'PASSWORD');
    add_db_server('d8', 'dc1', 1, 1,'','127.0.0.1', 'main_d8', 'user', 'PASSWORD');
    add_db_server('d9', 'dc1', 1, 1,'','127.0.0.1', 'main_d9', 'user', 'PASSWORD');
    add_db_server('da', 'dc1', 1, 1,'','127.0.0.1', 'main_da', 'user', 'PASSWORD');
    add_db_server('db', 'dc1', 1, 1,'','127.0.0.1', 'main_db', 'user', 'PASSWORD');
    add_db_server('dc', 'dc1', 1, 1,'','127.0.0.1', 'main_dc', 'user', 'PASSWORD');
    add_db_server('dd', 'dc1', 1, 1,'','127.0.0.1', 'main_dd', 'user', 'PASSWORD');
    add_db_server('de', 'dc1', 1, 1,'','127.0.0.1', 'main_de', 'user', 'PASSWORD');
    add_db_server('df', 'dc1', 1, 1,'','127.0.0.1', 'main_df', 'user', 'PASSWORD');
    add_db_server('e0', 'dc1', 1, 1,'','127.0.0.1', 'main_e0', 'user', 'PASSWORD');
    add_db_server('e1', 'dc1', 1, 1,'','127.0.0.1', 'main_e1', 'user', 'PASSWORD');
    add_db_server('e2', 'dc1', 1, 1,'','127.0.0.1', 'main_e2', 'user', 'PASSWORD');
    add_db_server('e3', 'dc1', 1, 1,'','127.0.0.1', 'main_e3', 'user', 'PASSWORD');
    add_db_server('e4', 'dc1', 1, 1,'','127.0.0.1', 'main_e4', 'user', 'PASSWORD');
    add_db_server('e5', 'dc1', 1, 1,'','127.0.0.1', 'main_e5', 'user', 'PASSWORD');
    add_db_server('e6', 'dc1', 1, 1,'','127.0.0.1', 'main_e6', 'user', 'PASSWORD');
    add_db_server('e7', 'dc1', 1, 1,'','127.0.0.1', 'main_e7', 'user', 'PASSWORD');
    add_db_server('e8', 'dc1', 1, 1,'','127.0.0.1', 'main_e8', 'user', 'PASSWORD');
    add_db_server('e9', 'dc1', 1, 1,'','127.0.0.1', 'main_e9', 'user', 'PASSWORD');
    add_db_server('ea', 'dc1', 1, 1,'','127.0.0.1', 'main_ea', 'user', 'PASSWORD');
    add_db_server('eb', 'dc1', 1, 1,'','127.0.0.1', 'main_eb', 'user', 'PASSWORD');
    add_db_server('ec', 'dc1', 1, 1,'','127.0.0.1', 'main_ec', 'user', 'PASSWORD');
    add_db_server('ed', 'dc1', 1, 1,'','127.0.0.1', 'main_ed', 'user', 'PASSWORD');
    add_db_server('ee', 'dc1', 1, 1,'','127.0.0.1', 'main_ee', 'user', 'PASSWORD');
    add_db_server('ef', 'dc1', 1, 1,'','127.0.0.1', 'main_ef', 'user', 'PASSWORD');
    add_db_server('f0', 'dc1', 1, 1,'','127.0.0.1', 'main_f0', 'user', 'PASSWORD');
    add_db_server('f1', 'dc1', 1, 1,'','127.0.0.1', 'main_f1', 'user', 'PASSWORD');
    add_db_server('f2', 'dc1', 1, 1,'','127.0.0.1', 'main_f2', 'user', 'PASSWORD');
    add_db_server('f3', 'dc1', 1, 1,'','127.0.0.1', 'main_f3', 'user', 'PASSWORD');
    add_db_server('f4', 'dc1', 1, 1,'','127.0.0.1', 'main_f4', 'user', 'PASSWORD');
    add_db_server('f5', 'dc1', 1, 1,'','127.0.0.1', 'main_f5', 'user', 'PASSWORD');
    add_db_server('f6', 'dc1', 1, 1,'','127.0.0.1', 'main_f6', 'user', 'PASSWORD');
    add_db_server('f7', 'dc1', 1, 1,'','127.0.0.1', 'main_f7', 'user', 'PASSWORD');
    add_db_server('f8', 'dc1', 1, 1,'','127.0.0.1', 'main_f8', 'user', 'PASSWORD');
    add_db_server('f9', 'dc1', 1, 1,'','127.0.0.1', 'main_f9', 'user', 'PASSWORD');
    add_db_server('fa', 'dc1', 1, 1,'','127.0.0.1', 'main_fa', 'user', 'PASSWORD');
    add_db_server('fb', 'dc1', 1, 1,'','127.0.0.1', 'main_fb', 'user', 'PASSWORD');
    add_db_server('fc', 'dc1', 1, 1,'','127.0.0.1', 'main_fc', 'user', 'PASSWORD');
    add_db_server('fd', 'dc1', 1, 1,'','127.0.0.1', 'main_fd', 'user', 'PASSWORD');
    add_db_server('fe', 'dc1', 1, 1,'','127.0.0.1', 'main_fe', 'user', 'PASSWORD');
    add_db_server('ff', 'dc1', 1, 1,'','127.0.0.1', 'main_ff', 'user', 'PASSWORD');

    //------------------------------------------------------------------------//
    //---VIP Blogs------------------------------------------------------------//
    //------------------------------------------------------------------------//
    // Usage: add_vip_blog(BLOG_ID, DS)
    // EX: add_vip_blog(1, 'vip1');
    // Only use VIP blogs if you meet 2 criteria, otherwise they are pointless:
    // 1. You have a specific blog that gets crazy crazy traffic to the point that it warrants it's own DB server
    // 2. You host it on it's own PHYSICAL db server

    //add_db_server('vip1', 'dc1', 1, 1,'127.0.0.1','127.0.0.1', 'wpmu_vip_1', 'db_user_name', 'db_user_name_pass');
    //add_vip_blog(1, 'vip1');

  • mprasodjo

    <?php

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

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

    ///DB Settings
    $dbname = "sourcedb"; //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 = 'main_'; //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 = 'user';
    $dbpass = 'password';

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

    //------------------------------------------------------------------------//
    //---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. Note this will only work if all the new databases are on the same MySQL server, and ONE set of credentials has access to all of them.
    3. Make sure all of your new db's exist (green text next to table name in db column below)
    4. In the status section, each table should show <i>not in new db (unless you've already run this script)</i>
    5. To start the copy process click here
    6. Be patient, depending on how many blogs you have, this could take a while
    7. Once completed, refresh this page by clicking here
    8. Check to make sure that in the status section all tables say <i>table in new db</i>
    9. Rejoice, I probably just saved you hours of your life!
    10. 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.