need help configuring the multi-db

help, can suppot team please help to set up my multi db for my site, I support team to accesss my c-panel and see what is happening to my site.. i'v check all my settings and follow arcoding to the multi db instalation, " my error is "error could not establish network, i also had followed the the instruction in this forum but i still have that error "error could not establish network"

  • hyree
    • Design Lord, Child of Thor

    and at
    http........scripts/move-blogs.php

    error says

    Warning: mysql_connect() [function.mysql-connect]: Host 'vps.host-mega.com' is not allowed to connect to this MySQL server in /home/webstlec/public_html/wp-content/scripts/move-blogs.php on line 64
    Could not connect to mysql

  • Barry
    • DEV MAN’s Mascot

    That error suggests either that the database doesn't exist or the user you have set up for your multi-db install hasn't been given the correct permissions to connect to that database.

    Can you give us more details of how you are setting things up, and what you have done so far?

  • Barry
    • DEV MAN’s Mascot

    That error suggests either that the database doesn't exist or the user you have set up for your multi-db install hasn't been given the correct permissions to connect to that database.

    Can you give us more details of how you are setting things up, and what you have done so far?

  • hyree
    • Design Lord, Child of Thor

    ----------------------------------db-config.php---------------------------------------------------
    // 16,256,4096
    define ('DB_SCALING', '4096');
    //------------------------------------------------------------------------//
    //---DC IPs---------------------------------------------------------------//
    //------------------------------------------------------------------------//
    // Usage: add_dc_ip(IP, DC)
    // EX: add_dc_ip('123.123.123.', 'dc1');
    add_dc_ip('67.23.249.', '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('webstlec_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,'','localhost', 'webstlec_global', 'webstlec_webs123', '5s1Vk3_26i154uB');

    add_db_server('000', 'dc1', 1, 1,'','localhost', 'webstlec_000', 'webstlec_webs123', '5s1Vk3_26i154uB');
    add_db_server('001', 'dc1', 1, 1,'','localhost', 'webstlec_001', 'webstlec_webs123', '5s1Vk3_26i154uB');

    ---------------------------------move-blogs.php---------------------------------------------------
    ///DB Settings
    $dbname = "webstlec_webs"; //This is your current database
    $blog_table_prefix = 'wezzy_'; //Prefix of your wpmu blog tables, most likely this won't need to be changed
    $newdb_prefix = 'webstlec_'; //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 = 'webstlec_webs123';
    $dbpass = '5s1Vk3_26i154uB';

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

  • Barry
    • DEV MAN’s Mascot

    Looks ok, except that I'd add 'localhost' to the '' in all your add_db_server calls so they'd look like:
    add_db_server('global', 'dc1', 1, 1,'localhost','localhost', 'webstlec_global', 'webstlec_webs123', '5s1Vk3_26i154uB');

    Have you created the 4096 databases on your system and granted full access to them to your db user?

  • hyree
    • Design Lord, Child of Thor

    hello, for reference , my "wp-confiq.php" looks like this :-

    -----------------------------wp-confiq.php---------------------------------------------
    / ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'webstlec_webs');

    /** MySQL database username */
    define('DB_USER', 'webstlec_webs123'');

    /** MySQL database password */
    define('DB_PASSWORD', '5s1Vk3_26i154uB');

    /** MySQL hostname */
    define('DB_HOST', 'localhost');

    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');

    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');

  • aecnu
    • WP Unicorn

    Greetings hyree,

    It appears that this ticket is resolved with the assignment of users to databases being configured one at a time.

    Thanks Erik for your input into this though I am sure it was not what hyree wanted to hear and a special thank you to Barry for his assistance and patience with this ticket.

    Cheers, Joe

  • hyree
    • Design Lord, Child of Thor

    hello again everyone,

    after getting finish assigning user to all database and edit a few of code at "db-confiq.php"
    i got this error when trying clicking the link at step 4 in /wp-content/scripts/move-blogs.php

    i also can log to my website. but when creating got this error

    Warning: mysql_set_charset() expects parameter 2 to be resource, boolean given in /home/...../public_html/wp-includes/wp-db.php on line 553

    Warning: mysql_set_charset() expects parameter 2 to be resource, boolean given in /home/.../public_html/wp-includes/wp-db.php on line 553

    Warning: Cannot modify header information - headers already sent by (output started at /home../public_html/wp-includes/wp-db.php:553) in /home/...../public_html/wp-includes/pluggable.php on line 866

    theres no table data in any of my databse except the global databse ive created

    please help with this..

  • hyree
    • Design Lord, Child of Thor

    i got this error, when try creating new sites

    Warning: mysql_set_charset() expects parameter 2 to be resource, boolean given in /home/...../public_html/wp-includes/wp-db.php on line 553

    Warning: mysql_set_charset() expects parameter 2 to be resource, boolean given in /home/.../public_html/wp-includes/wp-db.php on line 553

    but i cannot see any table in any of my created database, except the global database,

  • hyree
    • Design Lord, Child of Thor

    my new confiq changes is: -

    ----------------------------------db-config.php---------------------------------------------------
    // 16,256,4096
    define ('DB_SCALING', '4096');
    //------------------------------------------------------------------------//
    //---DC IPs---------------------------------------------------------------//
    //------------------------------------------------------------------------//
    // Usage: add_dc_ip(IP, DC)
    // EX: add_dc_ip('123.123.123.', 'dc1');
    add_dc_ip('67.23.249.', '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('webstlec_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,'','67.23.249.112', 'webstlec_global', 'webstlec_webs123', '5s1Vk3_26i154uB');

    add_db_server('000', 'dc1', 1, 1,'','67.23.249.112', 'webstlec_000', 'webstlec_webs123', '5s1Vk3_26i154uB');
    add_db_server('001', 'dc1', 1, 1,'','67.23.249.112', 'webstlec_001', 'webstlec_webs123', '5s1Vk3_26i154uB');

    ---------------------------------move-blogs.php---------------------------------------------------
    ///DB Settings
    $dbname = "webstlec_webs"; //This is your current database
    $blog_table_prefix = 'wezzy_'; //Prefix of your wpmu blog tables, most likely this won't need to be changed
    $newdb_prefix = 'webstlec_'; //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 = 'webstlec_webs123';
    $dbpass = '5s1Vk3_26i154uB';

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

  • Barry
    • DEV MAN’s Mascot

    1. You need to run move-blogs again - I've asked if you have already since the username update and you don't seem to be answering me.

    2. I wrote here https://premium.wpmudev.org/forums/topic/need-help-configuring-the-multi-db#post-199711 two weeks ago that you need to change the lines in your db-config, but the one you posted hasn't had those changed.

    3. Do you tables already have the prefix wezzy_ in the existing main database?

  • hyree
    • Design Lord, Child of Thor

    yes,
    i've created one test site and when i try to click the link at step 4 in /wp-content/scripts/move-blogs.php , the error still appear

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/webstlec/public_html/wp-content/scripts/move-blogs.php on line 140

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/webstlec/public_html/wp-content/scripts/move-blogs.php on line 141

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/webstlec/public_html/wp-content/scripts/move-blogs.php on line 140

  • hyree
    • Design Lord, Child of Thor

    yes my table prefix when first installing wordpress is wezzy_

    add_db_server('global', 'dc1', 1, 1,'localhost','localhost', 'webstlec_global', 'webstlec_webs123', '5s1Vk3_26i154uB');

    add_db_server('global', 'dc1', 1, 1,'localhost','localhost', 'webstlec_000', 'webstlec_webs123', '5s1Vk3_26i154uB');

    i've change to this before but my site cannot connect

  • Barry
    • DEV MAN’s Mascot

    You've created one test site? Sorry, not sure what you mean here. At this point you should have you 4096 dbs, you new global db and an existing db that your current WP multi-site runs off. You shouldn't have db.php or db-config in place until you have the move-blogs.php script running and working.

    Can you show a screenshot of your phpmyadmin screen showing the db names, and pos one of your existing wp database showing some of the tables?

  • hyree
    • Design Lord, Child of Thor

    add_db_server('global', 'dc1', 1, 1,'','67.23.249.112', 'webstlec_global', 'webstlec_webs123', '5s1Vk3_26i154uB');

    add_db_server('000', 'dc1', 1, 1,'','67.23.249.112', 'webstlec_000', 'webstlec_webs123', '5s1Vk3_26i154uB');

    change to this and i can see my website main page and also the screen shot that i ve just post,

    do i have to add global database the "db-config.php"?
    _________________________________________
    // Usage: add_global_table(TABLE_NAME)
    // EX: add_global_table('something');
    //--add_global_table('webstlec_global')--//
    _______________________________________

  • hyree
    • Design Lord, Child of Thor

    You've created one test site? Sorry, not sure what you mean here. At this point you should have you 4096 dbs, you new global db and an existing db that your current WP multi-site runs off. You shouldn't have db.php or db-config in place until you have the move-blogs.php script running and working.

    i guess im doing wrong at this part, ive upload three of the files and run the link move-blogs.php, do i have to creat one test site and run the move-blogs.php script?

    also

    this is my phpmyadmin screen shot

    sorry the table prefix "wezzy_" is not a real name but phpmyadmin screeshot 2 that i just blacklist is the real one and it's all the same prefix.

  • Barry
    • DEV MAN’s Mascot

    Also, can you show me the main database that you used when you created wordpress, not the new global one - that is the one we need to make sure we have the information correct for for move-blogs to work and the one I asked for - thanks.

  • hyree
    • Design Lord, Child of Thor

    let just say the prefix is

    wezzy_blogs
    wezzy_blog_versions
    wezzy_commentmeta
    wezzy_comments
    wezzy_links
    wezzy_options
    wezzy_postmeta
    wezzy_posts
    wezzy_registration_log
    wezzy_signups
    wezzy_site
    wezzy_sitemeta
    wezzy_terms
    wezzy_term_relationships
    wezzy_term_taxonomy
    wezzy_usermeta
    wezzy_users

    is that okay

  • hyree
    • Design Lord, Child of Thor

    You've created one test site? Sorry, not sure what you mean here. At this point you should have you 4096 dbs, you new global db and an existing db that your current WP multi-site runs off. You shouldn't have db.php or db-config in place until you have the move-blogs.php script running and working.

    barry, i've doing arcoding the above and i can see a table at one of my database when i click step 4 at move-blogs.php but there still an error

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/webstlec/public_html/wp-content/scripts/move-blogs.php on line 124

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/webstlec/public_html/wp-content/scripts/move-blogs.php on line 125

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/webstlec/public_html/wp-content/scripts/move-blogs.php on line 124

    but i can see a tables in one of the database other than global db, is that normal?

    i still dont know how the move-blogs function, do i have to use it each time theres a new blogs is created?

  • Barry
    • DEV MAN’s Mascot

    Still waiting for those screenshots and then I'll be able to debug your move-blogs.php settings.

    So you know, i can't work off the ones you are obfuscating, because the parts you are removing are the parts that I need to debug your settings.

  • Barry
    • DEV MAN’s Mascot

    I'm not sure you are reading my replies here :slight_smile: In order to debug the settings you have for your move-blogs I really need more information from you - I've asked for the screens that I know will have the information I need but you don't want to seem to show them to me.

    Now, that screen shot shows green for the tables, does it show that for all the tables? Can you check some of your new databases and see if they contain tables (phpmyadmin usually shows a number next to the db's that show the number of tables in them).

  • Barry
    • DEV MAN’s Mascot

    If you have tables in the global and another db, and only have the main and 1 sub site setup then that sounds about right. Just check that your non global db only has the tables for that one site.

    So if that's the case then you can dispense with move-blogs and then work on setting up the db config file. So it's now a case of working out what is wrong with that.

    Can you copy the files back in now, and if possible locate your php error log, as that will be the thing that will help us debug that part.

  • hyree
    • Design Lord, Child of Thor

    barry , i dont know if my configuration of db-config.php is correct, when i change the code in db-confiq.php from :-

    add_db_server('000', 'dc1', 1, 1,'','67.23.249.112', 'webstlec_000', 'webstlec_webs123', '5s1Vk3_26i154uB');

    to this

    add_db_server('000', 'dc1', 1, 1,'','localhost', 'webstlec_000', 'webstlec_webs123', '5s1Vk3_26i154uB');

    i don't see any mysql warnings / error database connection again.

    how do i know that i am using the separated database for my sub sites?

  • hyree
    • Design Lord, Child of Thor

    but before this i've try to put the code below in "db-confiq.php"

    add_db_server('000', 'dc1', 1, 1,'','localhost', 'webstlec_000', 'webstlec_webs123', '5s1Vk3_26i154uB');

    i've got error establish database connection, its a bit weird it works this time.

    maybe i do the wrong step like uploading all 3 plugin files simultaneously

  • hyree
    • Design Lord, Child of Thor

    i make change the above code to according to

    Looks ok, except that I'd add 'localhost' to the '' in all your add_db_server calls so they'd look like:
    add_db_server('global', 'dc1', 1, 1,'localhost','localhost', 'webstlec_global', 'webstlec_webs123', '5s1Vk3_26i154uB');

    -----db-config.php---------------------------------------------------
    // 16,256,4096
    define ('DB_SCALING', '4096');
    //------------------------------------------------------------------------//
    //---DC IPs---------------------------------------------------------------//
    //------------------------------------------------------------------------//
    // Usage: add_dc_ip(IP, DC)
    // EX: add_dc_ip('123.123.123.', 'dc1');
    add_dc_ip('67.23.249.', '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('webstlec_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,'localhost','localhost', 'webstlec_global', 'webstlec_webs123', '5s1Vk3_26i154uB');

    add_db_server('000', 'dc1', 1, 1,'localhost','localhost', 'webstlec_000', 'webstlec_webs123', '5s1Vk3_26i154uB');
    add_db_server('001', 'dc1', 1, 1,'localhost','localhost', 'webstlec_001', 'webstlec_webs123', '5s1Vk3_26i154uB');

    and there is no mysql warnings or any db connection error at my front page site and dashboard

  • hyree
    • Design Lord, Child of Thor

    ----db-config.php---------------------------------------------------
    // 16,256,4096
    define ('DB_SCALING', '4096');
    //------------------------------------------------------------------------//
    //---DC IPs---------------------------------------------------------------//
    //------------------------------------------------------------------------//
    // Usage: add_dc_ip(IP, DC)
    // EX: add_dc_ip('123.123.123.', 'dc1');
    add_dc_ip('67.23.249.', '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('webstlec_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,'localhost','localhost', 'webstlec_global', 'webstlec_webs123', '5s1Vk3_26i154uB');

    add_db_server('000', 'dc1', 1, 1,'localhost','localhost', 'webstlec_000', 'webstlec_webs123', '5s1Vk3_26i154uB');
    add_db_server('001', 'dc1', 1, 1,'localhost','localhost', 'webstlec_001', 'webstlec_webs123', '5s1Vk3_26i154uB');
    ......
    ......
    //--add_db_server('vip1', 'dc1', 1, 1,'64.120.23.72','192.168.0.101', 'wpmu_vip_1', 'db_user_name', 'db_user_name_pass');--//
    //------------------------------------------------------------------------//
    //---VIP Blogs------------------------------------------------------------//
    //------------------------------------------------------------------------//
    // Usage: add_vip_blog(BLOG_ID, DS)
    // EX: add_vip_blog(1, 'vip1');

    //--add_vip_blog(1, 'vip1');--//
    ?>

  • Barry
    • DEV MAN’s Mascot

    Sorry - I've been offline since we last chatted on friday.

    Looks like you commented out the lines i was worried about, which is good (the vip ones).

    So now, when you place the db.php and your db-config.php back in the wp-content directory, and load your main site, can you see the content and move around in the admin area?

  • Barry
    • DEV MAN’s Mascot

    Cool, that means that the main global db is working. Can you see the site and dashboard for the other site you have? I think I remember you saying that you only have the one other one set up so far.

    If you can, then we know it's reading from the databases correctly so far.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.