Single database for multiple sites

Howdy! I’m looking to share one database between multiple installs for the purpose of sharing users and usermeta tables. Where do I change the path to the database for the additional installs to match the first install?

Hi Jordan,

I haven’t tested this, but this is where I’d start:

  1. Change DB_HOST in wp-config.php on the sites using the other site’s database to: other-site-domain.local
  2. Create a new user on the database you wish to share that allows remote connections. You can do this with Adminer or Sequel Pro.
  3. Change DB_USER, and DB_PASSWORD to the user created in the step above.
  4. Change DB_NAME to the remote database name

Hi @jordonrupp

I haven’t tried what Clay recommends and it looks like it would work, but maybe you can approach the problem from a different direction.

I’ve occasionally turned to WordPress Multisite when I need to have the same users on different sites. It does add additional complexity to the overall system, however depending on your needs, it might be just the solution that you need.

I think this article does a decent job of outlining the big concerns to think about when approaching multisite: https://premium.wpmudev.org/blog/ultimate-guide-multisite/

– Ben

Thanks, Clay! I’ll give that a try.

Thanks, Ben! Good suggestion. I was hoping to avoid those complexities, but I think I’m in a scenario that is a good fit for Multisite.

1 Like