Walking Through Setup

This might seem redundant, but I found the instruction for this plugin confusing, so I though I would walk through the process and let everyone see the results. Being a graphic artist, by programming skills are a big ZERO. So I hope this inspires others to step beyond their comfort zone also.
_________________________
Wordpress 3.1.1
Multi-DB plugin 3.0.6

IP address (173.247.249.5)

Dedicated Server info:
Intel Xeon X3414 2.40GHz quad
Apache version 2.2.17
PHP version 5.2.16
MySQL version 5.0.92-community
Architecture x86_64
Operating system linux
_______________________

Starting Point
Created a new site
Installed and activated Wordpress Multisite
Verified by creating a sub.site. All is working well
---Assuming all is set up correctly to this point---

STEP 1 & 2 of Multi-DB
Created 16 databases, based on the generated code, provided by WPMU DEV
<(Use WPMU DEV tool) https://premium.wpmudev.org/db-tools/db_sql.php&gt;
Also created a global database per instructions. (see screen shot#1)
Note I chose to manual add the databases through MySQL in my Cpanel

For training purposes:
Initial WP database facts:
Database name: leonaaz_az1
Database username: user
Database password: simplepassword
Database Table prefix: wp_2
Total databases: 18 : 16 generated, 1 WP original, 1 global
All databases has been associated to the same user and password with full privileges.
See Screen shot.

BTY, this is merely a dummy test to learn Wordpress Multisites

This completes Steps 1 & 2 of the WPMU Multi-DB instructions

QUESTIONS 1:
1/2a. Will it affect performance having 18 databases?
1/2b. Why have a global database? Is it just another database that is named global?
1/2c. Can you explain the 16, 256, 4096 rule for databases?

Next stop coming... STEP #3
This is where the rubber meets the road and can get confusing. My hope is that I can clarify this process as we non-programmers learn together.

Do have a thumbs up... is this correct?

  • Larry_D

    STEP #3
    Time to modify the db-config.php file found in the plugin folder

    3:1a. Line#10: define ('DB_SCALING', '16':wink:; <default setting>
    Change the number 16 to the appropriate number: 16, 256 or 4096
    I left the line unchanged at the default of '16'

    3:2a Line#16: add_dc_ip('127.0.0.', 'dc1':wink:;<default setting>
    add_dc_ip('1173.247.249.', 'dc1':wink:; <note deleted the numbers after the 3rd period, but not the period.>

    The IP address I am using for this is: 173.247.249.5: This is what was pasted on the line: 173.247.249.

    3:3a. Line#25: add_global_table('affiliatedata':wink:; <default setting>
    add_global_table('leonaaz_global':wink:; <my changes>

    Time to generate the BD Servers, follow linking the link in the instructions.
    <(Use WPMU DEV tool)https://premium.wpmudev.org/db-tools/db_servers.php >

    See screen shot for details

    This is what was generated.
    add_db_server('0', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_0', 'user', 'simplepassword':wink:;
    add_db_server('1', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_1', 'user', 'simplepassword':wink:;
    add_db_server('2', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_2', 'user', 'simplepassword':wink:;
    add_db_server('3', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_3', 'user', 'simplepassword':wink:;
    add_db_server('4', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_4', 'user', 'simplepassword':wink:;
    add_db_server('5', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_5', 'user', 'simplepassword':wink:;
    add_db_server('6', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_6', 'user', 'simplepassword':wink:;
    add_db_server('7', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_7', 'user', 'simplepassword':wink:;
    add_db_server('8', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_8', 'user', 'simplepassword':wink:;
    add_db_server('9', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_9', 'user', 'simplepassword':wink:;
    add_db_server('a', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_a', 'user', 'simplepassword':wink:;
    add_db_server('b', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_b', 'user', 'simplepassword':wink:;
    add_db_server('c', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_c', 'user', 'simplepassword':wink:;
    add_db_server('d', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_d', 'user', 'simplepassword':wink:;
    add_db_server('e', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_e', 'user', 'simplepassword':wink:;
    add_db_server('f', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_f', 'user', 'simplepassword':wink:;

    Tip to add this to the db-config.php
    Highlight all the samples and past the new code in it's place. These are line 65 thru 80 on my document.

    Note that I added my IP address in both the DB Local Host & DB Remove Host fields. I do not have a remove host IP so I duplicated the DP local Host field into the DB Remote host field.

    Now, we must change the global DB line. It is found on line 63 of my sample.

    All I did was change copy one of the lines we just pasted on that line and changed the database name to global.
    add_db_server('0', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_global', 'user', 'simplepassword':wink:;

    See screen shot.

    This conclude STEP #3

    I hope this helps.

    On to STEP #4

  • Larry_D

    STEP #4 move-blog.php
    Before we start, create a folder in the wp-content directory, name it scripts. This folder will be placed in the same location as the blogs.dir you created when you first established your multisite.

    Time to modify move-blog.php

    This where I think I'm having trouble. The instruction are minimal for non-programmers.

    Changing lines 19 thru 29
    Line #19: Change to original database that was created for Wordpress
    $dbname = "old_db_name"; <default setting>
    $dbname = "leonaaz_az1"; <my change>

    Line #20: Prefix of your wpmu blog.
    $blog_table_prefix = 'wp_'; <default>
    $blog_table_prefix = 'wp_2_'; <my change> 4a. My Wordpress Database Table prefix is: wp_2. Was it correct to add the _ after 2?

    Line #21.
    $newdb_prefix = 'newdbname'; <default>
    $newdb_prefix = 'leonaaz_'; <my change> 4b. Is it correct to add the _ at then end of the database prefix?

    Lines #24
    $dbhost = 'localhost'; <default>
    $dbhost = 'localhost'; <my change> 4c. Do we need to change local host? If so, to what?

    Line #25
    $dbuname = 'user'; <default>
    $dbuname = 'user'; <my change>

    Line #26
    $dbpass = 'pass'; <default>
    $dbpass = 'simplepassword'; <my change>

    Line #29
    $db_scaling = '256'; <default>
    $db_scaling = '16'; <my changes>

    QUESTIONS
    4a. Line #20 My Wordpress Database Table prefix is: wp_2. Was it correct to add the _ after 2?
    4b. Line #21Is it correct to add the _ at then end of the database prefix?
    4c. Line #24 Do we need to change local host? If so, to what?

    OK, finished with instruction #4 and saving move-blogs.php

  • Larry_D

    Step #5
    Moving dp.php and dp-config.php into the wp-content folder
    Next move move-blogs.php into the scripts folder we created earlier.

    From my browser I typed the following address:
    http://leonaaz.com/wp-content/scripts/move-blogs.php

    And this is the error code that comes up:
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user'@'localhost' (using password: YES) in /home/leonaaz/public_html/wp-content/scripts/move-blogs.php on line 64
    Could not connect to mysql

    I hope this can be resolved soon so we can then verify the completion of this test project.

    OK, WPMU gods help please.

    I hope this process helps others. :^)

  • Larry_D

    ERROR Message corrected by changing the $dbuname line. Below are my current settings on move-blogs.php
    ____________________________________
    $dbname = "leonaaz_az1";
    $blog_table_prefix = 'wp_2_
    ';
    $newdb_prefix = 'leonaaz_';

    //We need info to connect to the databases
    $dbhost = 'localhost';
    $dbuname = 'leonaaz_user'; <only change was to this line from user to leanaz_user>
    $dbpass = 'simplepassword';

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

    Now when I go to, http://leonaaz.com/wp-content/scripts/move-blogs.php I see the proper page.

    So far so good, now it's time to follow the instruction found in the browser window.
    BROWSER WINDOW INSTRUCTIONS
    1. Tested on PHP 5 & MySQL 5 <CHECK>
    2.Make sure all of your new db's exist (green text next to table name in db column below) <CHECK>
    3.In the status section, each table should show not in new db (unless you've already run this script) <CHECK>.
    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 table in new db
    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..

    When I click on the link under #4 I get this error now.....
    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/leonaaz/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/leonaaz/public_html/wp-content/scripts/move-blogs.php on line 125

    and so on.......

    Stuck on #4, please ........................Help!

    Does the fact that I name my table prefix 'wp_2' have anything to do with this.

  • dapadoo

    Hi Larry, learning how to set up Multi-DB is challenging but worth it once you do.

    One of the things I see is wrong is you have your IP address twice in the db-config.php file. Where I placed the "7" is where you need to remove the IP address from. Leave the two ' in place.

    add_db_server('0', 'dc1', 1, 1,'7777777','174.121.148.119', 'inohc_test_0', 'inohc_test', 'xxxxxxx');

    Check out the following link it may help you some on the rest of the configuration needed.

    https://premium.wpmudev.org/forums/topic/i-need-to-get-multi-db-set-up-asap-but-having-problems

  • Larry_D

    Here's the update. No changes. Here is what I've tried.

    Removed my IP address from the as shown below from all locations. Lines #65-#80
    add_db_server('0', 'dc1', 1, 1,'173.247.249.5','173.247.249.5', 'leonaaz_global', 'user', 'simplepassword'); <old>

    add_db_server('0', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_global', 'user', 'simplepassword'); <new>

    add_db_server('0', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_0', 'user', 'simplepassword'); <new>
    add_db_server('1', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_1', 'user', 'simplepassword'); <new>
    add_db_server('2', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_2', 'user', 'simplepassword'); <new>
    add_db_server('3', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_3', 'user', 'simplepassword'); <new>
    add_db_server('4', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_4', 'user', 'simplepassword'); <new>
    add_db_server('5', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_5', 'user', 'simplepassword'); <new>
    add_db_server('6', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_6', 'user', 'simplepassword'); <new>
    add_db_server('7', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_7', 'user', 'simplepassword'); <new>
    add_db_server('8', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_8', 'user', 'simplepassword'); <new>
    add_db_server('9', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_9', 'user', 'simplepassword'); <new>
    add_db_server('a', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_a', 'user', 'simplepassword'); <new>
    add_db_server('b', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_b', 'user', 'simplepassword'); <new>
    add_db_server('c', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_c', 'user', 'simplepassword'); <new>
    add_db_server('d', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_d', 'user', 'simplepassword'); <new>
    add_db_server('e', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_e', 'user', 'simplepassword'); <new>
    add_db_server('f', 'dc1', 1, 1,'','173.247.249.5', 'leonaaz_f', 'user', 'simplepassword'); <new>

    Looking at line #16 of the db-config.php
    add_dc_ip('173.247.249.', 'dc1');

    Add the complete IP address to line #16
    add_dc_ip('173.247.249.5', 'dc1'); <no change>
    Removing the last numbers before the last period on line #16 returning to it's back.
    _____________________

    Continue to have error in browser window at addresses http://leonaaz.com/wp-content/scripts/move-blogs.php?table=copy

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

    Continued error on home page www. leonaaz.com
    Warning: mysql_get_server_info(): supplied argument is not a valid MySQL-Link resource in /home/leonaaz/public_html/wp-content/db.php on line 669

    Warning: Cannot modify header information - headers already sent by (output started at /home/leonaaz/public_html/wp-content/db.php:669) in /home/leonaaz/public_html/wp-includes/functions.php on line 3191
    Error establishing a database connection

  • Larry_D

    Next I removed the '_' after leonaaz on line #21 of move-blogs.php
    $newdb_prefix = 'leonaaz_'; //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

    Doing that took me backwards the when I run the move-blogs.php in the browsers window <http://leonaaz.com/wp-content/scripts/move-blogs.php> now I get the following error.

    Houston, we have a problem!
    Looks like you need to create your new db's! If you're lucky, this link still works - click me
    Database Error: Access denied for user 'leonaaz_user'@'localhost' to database 'leonaazb'

    So I have returned the '_' to the end of the "leonaaz' on line #21

    Still dead in the water!!!

  • dapadoo

    ODD, DB's _3 and_b both have an added 9 tables. That tells me the script worked because the tables were added. The other DB's would remain empty until a new blog is made that fills its spot.

    Next I removed the '_' after leonaaz on line #21 of move-blogs.php
    $newdb_prefix = 'leonaaz_'; //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

    The prefix is for the tables, not the database name. The tables are set as wp_ unless you renamed them.

  • look4

    I think it is wrong to think of this as a classic "plugin" per say, i deem it more like a hack

    I myself am just unable to get the created databases associated with a user account.

    phpMyAdmin only shows the inital install database and not any of the databases added through the SQL query.

    I would love someone to give me some guidance on how to add the damn users to the database i think it is essentially the root of most peoples problems with this.

  • Barry

    I think it is wrong to think of this as a classic "plugin" per say, i deem it more like a hack

    It's a database abstraction layer using functionality to enable such built into WordPress - wordpress.com uses a similar method to have their databases sharded.

    I myself am just unable to get the created databases associated with a user account.

    If you don't have root access or can run queries then you will need to contact your hosts support and ask them. Providing rights and permissions to databases isn't something possible via the plugin as it doesn't have the rights to do so if you get what i mean.

    phpMyAdmin only shows the inital install database and not any of the databases added through the SQL query.

    Hmmm - sounds like either you've got the database names wrong (if you are on shared cpanel hosting then your database names need to be prefixed by a specific string) - you may have to create a database via cpanel and see what it names it and try from that.

    I would love someone to give me some guidance on how to add the damn users to the database i think it is essentially the root of most peoples problems with this.

    Again, if you don't have root access then you'll need to do it via your control panel (cpanel?) or ask your host to do it.

  • Barry

    why cant the dev just make a video walk through of this whole damn process rather than this total lack of documentation.

    Because every single setup and host (and control panel or version of control panel) or SQL front-end is different and would mean creating hundreds of videos or explaining the differences between them hundreds of times.

    This is a complex system to get up and running, it can't really be made any easier. The thinking has always been that if you *need* multiple databases then you are at the point that you are hosting a larger than average number of sites/blogs and you would have some server / database level skills already (you would, after all, have to support your users if you have database or server issues).

  • Larry_D

    This is what I end up with every time I create a multiDB. No websites!

    Warning: mysql_get_server_info(): supplied argument is not a valid MySQL-Link resource in /home/rest121/public_html/wp-content/db.php on line 669

    Warning: Cannot modify header information - headers already sent by (output started at /home/rest121/public_html/wp-content/db.php:669) in /home/rest121/public_html/wp-includes/functions.php on line 3191

    So I am dead in the water!

    Do you have cpanel? As you are only using 16 databases, can you not create them, create the user ans assign the rights via cpanel? Instead of struggling with the SQL.

    Yes I do have Cpanel and have input the 16 plus global in manually. No big deal there. Each always having the same username, password and priv. at the original wpress database.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.