Multi DB Installation Problem - Error Establishing a Database Connection

Good morning, I hope everything at wpmu dev is going well

I have a question concerning the implementation of Multi DB

We currently have a multisite/multinetwork implementation. Everything was running correctly prior to the Multi DB installation. Our configuration consists of a WP app server communicating with a remote db server on a non standard Mysql port. As an example our configuration consists of WP app server A on IP 111.222.333.444 communicating with MySQL db server B on IP 555.666.777.888 on port 2321. With the standard installation we address this by specifying the db server and port in the wp-config.php file. Everything was working correctly before I started to implement Multi DB.

As I went through the documentation for the setup, I specified the remote host and port in the move-blogs.php file on line 24 as follows: $dbhost = ‘555.666.777.888:2321’;

However in the db-config.php file the port for the db server is not specified and there are two places that seem like it should be?? The first is on line 16 where it specifies the add dc ip (add_dc_ip(‘111.222.333.', 'dc1'):wink:, and starting at line 65 where it is specifying add db server entries (add_db_server('0', 'dc1', 1, 1,’555.666.777.888’,’111.222.333.444', 'wpress_0', ‘user act', ‘password');.

When I ran the move-blogs.php file as documented – the page came up as expected. After I clicked on the copy process on line 5 – everything seemed to work correctly and the page showed me that all the db’s existed and that all tables existed in new db’s as listed. I confirmed this by looking through all the new db’s and seeing all the blog tables spread across them. Unfortunately when I try to access the wp installation I get: Error Establishing a Database Connection

When I look in the wpress_global database I can see all the default tables that come with WP, however, I do NOT see any of the tables that it seems should have been created by the db-config.php file starting at line 25 (affiliate data, affiliate referrers etc).

I have updated the wp-config.php file to reflect using the wpress_global database have not gotten the system back up. I have not been able to go in and activate the multi db plugin

Any suggestions??

  • Adam Czajczyk

    Hey David,

    I hope you're well today and thank you for your question!

    I can see that you've already asked similar question not so long ago here:

    https://premium.wpmudev.org/forums/topic/good-afternoon-i-have-run-through-the-configuration-for

    Didn't the Kasia's advice work for you or did something change recently? Please advise!

    I''ve also asked our 2nd-line support guys for a helping hand here as I'm currently not able to try to reproduce this with a "remote database setup". I'm sure they'll come up with a solution for your. Please note though that their response time might be a bit longer than mine here on support forum.

    Please keep an eye on this thread!

    Cheers,
    Adam

  • David

    Good evening.

    I wanted to let you know that I have gotten the system back up and it "seems" like the multi db plugin is working,. I ended up adding the mysql port to the db-config.php file also and it came back up.

    After bringing the system up and looking around some I have a couple of questions about how it operates. If you could help me with this understanding that would be great.

    1. should I edit the wp-config.php file and change the database to the dbname_global db now? or does it matter? If not is anything being stored there?
    2. Is the original wp database that all the data started in still required? If I deleted it what is the impact to the system?
    3. I'm at a loss how the dp.php and db-config.php files in the wp-content folder are being found/launched?? I was under the impression that the wp system only automatically ran files in the mu-plugins directory? Do you have a link or some reference material I can review on how this is happening?
    4. What kind of randomization is the plugin using to spread the users amongst the databases?? in going through them I saw some databases that had a number of users in them yet some others were still empty. I'm interested in how it is randomizing the distribution?

    I appreciate your help and patience.

    Regards
    Dave

  • Adam Czajczyk

    Hey David,

    It's great to know that you managed to solve the issue and thanks for sharing your solution with us. I'm sure some other members of our community will greatly benefit from this information!

    As for your other questions. This are questions of very technical nature, strictly related to how does the Multi-DB code is working. Let me then include one of our developers @Hoang Ngo into this conversation. I've already asked him for help and once he's back online for work he'll provide you with information you request.

    Cheers,
    Adam

  • Hoang Ngo

    Hi Dave,

    I hope you are well today.

    1. should I edit the wp-config.php file and change the database to the dbname_global db now? or does it matter? If not is anything being stored there?

    No, you don't have to update the database name in wp-config.php. Just leave it as is :slight_smile:

    2. Is the original wp database that all the data started in still required? If I deleted it what is the impact to the system?

    Multi DB will override the original WordPress DB class, if you don't put your original database as a database server, I think we can delete it. However, as WordPress world is about plugins & themes, some plugins or themes will query direct from the database, so remove it might cause potentials error. I think for compatibility & prevent potential issues, we should keep it.

    3. I'm at a loss how the dp.php and db-config.php files in the wp-content folder are being found/launched?? I was under the impression that the wp system only automatically ran files in the mu-plugins directory? Do you have a link or some reference material I can review on how this is happening?

    The WordPress native only support mu-plugins. The db.php & db-config.php will be handled by Multi-DB plugin, not WordPress native.

    4. What kind of randomization is the plugin using to spread the users amongst the databases?? in going through them I saw some databases that had a number of users in them yet some others were still empty. I'm interested in how it is randomizing the distribution?

    The plugin will loop through databases, and pick the most available. So if the database still fast & reliable, the plugin will use it until it becomes full or slower than the other, then the plugin will pick other databases.

    If you have any additional issues, please let us know and we'll be happy to help.

    Best regards,
    Hoang

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.