• What I would like to do is use WP Multisite and have a separate database for each site as opposed to multiple tables. The idea behind this is to keep the sites separate and running fast as running a few hundred sites on a single database would begin to become slower than if they were each on their own database. However, it would still allow me to update all sites core wordpress files in one location.

    I know there is sharedb, hyperdb and multi-db plugins but as far as I am aware they will use multiple databases but not spread each site in its own database.

    Some help pointing me in the right direction would be appreciated

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    There isn’t one. There used to be a plugin called wp-hive that did this, but it seems to have fallen by the wayside.

    You COULD have a custom wp-config.php that checks for domains and routes to different DB tables, but that’s as close as I can get, and god knows what it’d do to your wp-content.

    Thread Starter nitrous604

    (@nitrous604)

    Thanks for the reply. Can you think of an example I could look at where a wp-config.php points to different databases?

    If I have to write some customized code in each wp-config for this to work I think I could deal with that to make it work.

    You cannot simply modify wp-config.php to point at multiple databases. If you need those specific requirements and no existing plugin can do that, then you will have to write your own plugin or hire someone to do it for you.

    You will have to think exactly what you want your plugin to do besides “have a separate database for each site”. For example what happens if someone creates a new site… how does a new database get created for that site.

    Will your WP system really be that big to require multiple databases vs one large database server? Our system is fairly large and we havent come to that point yet (multiple db): 300+ sites, 3000+ tables, 4GB database. We are still on one database server which is mostly idle.

    Thread Starter nitrous604

    (@nitrous604)

    We currently host 900+ websites that all receive a large amount of traffic so yes the demand is there.

    As far as creating new databases I already created a PHP interface that creates new MySQL databases with specific user permissions. I then can just plug them in to each wp-config.php or set it to automatically create new wp-config.php files every time I create a new database. That part I’m fine with as that’s simple PHP.

    The problem is working with WordPress Multisite and getting each new site/theme to work with each new database.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    You cannot simply modify wp-config.php to point at multiple databases

    Yes you can. It’s PHP.

    Psudeocode follows:

    IF domain == domain.com
      { db prefix = wp_foobar_ ; db name = domain.om_sql}

    And on and on 🙂 It’s basic PHP if/then checks on the domain name.

    I believe WPMUDEV has a plug-in to do what you want.

    Thread Starter nitrous604

    (@nitrous604)

    Outdoorsmen, that plugin is only to create multiple databases. However, each site does not get its own database. I had already looked into that.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WP Multsite with Separate DB's for each site’ is closed to new replies.