Skip to content

Using a home database

Ron Rennick edited this page Jul 24, 2019 · 1 revision

Sometimes you may wish to have the main site in the network in its own database. Reasons for this may include a main site that receives a lot of traffic, or you may be using a plugin which creates larger than normal database tables for the main site.

Follow the same setup steps but include this line in the config area of db-settings.php

$enable_home_db = true;

Also create an additional database called your_prefix_home when you create the rest of the databases. When the tables are migrated,

  • all the default WordPress tables for the main site (blog) will be placed in the home database,
  • the global tables, such as users and multisite global tables, will still go in the global database.
  • BuddyPress tables, if you are using it, will go in the global database.

If you are creating your databases via SSH access, you can include the home database as follows:

$ for D in 0 1 2 3 4 5 6 7 8 9 a b c d e f home global; do \
echo CREATE DATABASE your_prefix_$D';' >> db-create.sql; \
echo GRANT ALL ON your_prefix_$D.* TO your_user';' >> db-create.sql; \
done
Clone this wiki locally