Can multiple WordPress sites use the same database?

6 minutes
WordPress database architecture - Multisite network and separate installations sharing one database

Can multiple WordPress sites use the same database?

Yes. Two mechanisms do it: a WordPress Multisite network, or separate installations distinguished by table prefixes. Beyond the fact that the data sits in one place, they have almost nothing in common. They differ in the management model, in how much isolation you actually get, and in what happens when one site has to be restored from a backup.

What follows is the difference between the two approaches, the technical consequences of each, and the conditions under which either one makes sense.

Multisite versus separate installations

FeatureWordPress MultisiteSeparate installations
UsersShared across the networkIndependent per site
Plugins and themesShared files, managed network-wideSeparate per site
AdministrationOne network dashboardSeparate dashboards
Configuration freedomConstrained by network settingsFull
Core updatesOne update for every siteSeparate for each

Multisite turns a single installation into a network of sites. Some tables are shared across the whole network: user accounts in wp_users and wp_usermeta, plus the tables that manage the network itself, wp_blogs, wp_site and wp_sitemeta. Every site added after the first gets its own set of content tables, numbered in the name: wp_2_posts, wp_2_options, wp_2_comments and so on.

Separate installations keep their own dashboards, users, plugins and themes. The only thing joining them is that they write to the same database using different prefixes. Whether that makes them independent is the question this article is really about, and the answer is not the one most guides give.

The distinction comes down to management philosophy. Multisite fits a portfolio of related sites under common oversight: branch networks, regional variants, brands belonging to one owner. Separate installations fit cases where the sites are meant to stay apart.

How WordPress stores data

WordPress keeps content, settings and user data in a MySQL or MariaDB database, in tables with a fixed structure. Every table name starts with a prefix, wp_ by default. Hence wp_posts, wp_users, wp_options. WooCommerce adds its own tables on top of this same structure — see where WooCommerce actually stores its data.

That prefix is the only mechanism allowing several independent installations to coexist in one database. It is not an isolation mechanism. It is a name-collision mechanism. The difference matters, and we return to it under security.

How table prefixes work

The prefix is configured in wp-config.php:

php

$table_prefix = 'shop1_';

The installer then creates shop1_posts, shop1_users and the rest. A second installation with the prefix blog2_ builds its own disjoint set in the same database.

The trailing underscore is required. WordPress appends the table name with no separator, so shop1 produces shop1posts.

One practical note. Changing the prefix on a live site is not a one-line edit. Besides renaming the tables, you have to update the entries that carry the prefix inside the data itself: the user roles key in the options table, and the capabilities entries in user metadata. Skip that step and you lock yourself out of the admin.

Security: what a shared database actually gives you

This needs stating plainly, because most guides soften it.

If every installation connects to the database as the same MySQL user, and that is the default and by far the most common setup, then there is no isolation between the sites. Compromising one installation gives an attacker full read and write access to the tables of all the others, including their user tables. The prefix is no barrier at all, because its only job is to keep names apart.

Reducing that risk requires a separate MySQL user per installation, with privileges scoped to its own tables. A wildcard grant on the prefix pattern covers most of it, since the underscore has to be escaped in the pattern. It works, but it is awkward to maintain: any plugin that creates a table outside the prefix convention needs its privileges granted by hand, and the omission only surfaces as an error at the moment the plugin first tries to write.

Everything else is standard and still applies: separate strong passwords, current core and plugin versions, monitoring of database access, and file permission control. None of those address the shared-credential problem, so treat them as necessary rather than sufficient.

Backups: the consequence people miss

A shared database simplifies making backups. One dump covers every site. The problem appears on the way back.

Restoring that dump rolls back the state of every installation in the database, not only the one that needed fixing. If one site was breached on Wednesday while the others carried on taking orders, restoring Tuesday’s copy costs the other sites two days of work.

The workaround is selective restore: extracting only the tables with the right prefix from the dump. It can be done, but it needs a written procedure prepared in advance, not improvisation under the pressure of an incident. The same problem exists in Multisite, where part of the data is shared across the network as well.

Trade-offs at a glance

In favour of a shared database:

simpler hosting configuration where the number of available databases is limited

one backup procedure

fewer places to monitor

Against:

no real isolation when the sites share a database user

restoring a backup affects every site at once

load generated by one site affects the others

harder diagnostics, because queries from different sites mix in the logs

separating a site onto its own infrastructure later requires a migration

When each option makes sense

Choose Multisite when the sites belong to one owner, share editorial staff, and have similar functionality. The typical case is a network of regional variants, or a brand portfolio managed by one team. Note that plugins and themes are shared across the network, so a failed update affects every site at once.

Separate installations in a shared database are a situational solution. They make sense where hosting limits the number of databases and the sites are non-critical: internal tools, test environments, low-traffic projects. This is not an architecture to choose for sites taking payments or processing personal data.

Separate databases remain the default wherever isolation, predictable recovery, and independent scaling matter. The cost of an additional database today is marginal against the cost of a single incident spanning several sites.

What to settle before you commit

The decision to share a database is easy to make and hard to reverse. Separating installations years later means migrating data, repointing configuration, and a maintenance window for every site in the set. That migration itself is covered in can I copy a WordPress site to another domain?

If you are planning the architecture for a portfolio of sites, settle three things at the start. Will any of these sites ever be sold or spun out separately? What is an acceptable recovery time after a failure? Who owns updates? The answers usually decide the choice faster than any comparison of technical capabilities.

At WLC we design and rebuild architectures of this kind, including separating networks that have outgrown the scale they were built for.

Pwel Zmyslowski

Paweł Zmysłowski

CEO WLC.team

At White Label Coders responsible for the sales process and sales team, still involved in the analytical and advisory roles in case of more complex projects.

Author page

Is your WordPress “working, but slow”?

MORE ARTICLES

Read also

  • Why do my comparison tables cause layout shift?
    11 minutes

    Why do my comparison tables cause layout shift?

    Comparison tables often cause layout shift because parts of them load without reserved space, so content jumps around as the page renders. This happens when images lack dimensions, dynamic data loads without placeholders, or custom fonts reflow text after the first paint. Layout shift hurts user experience and your Core Web Vitals, which feed into…

    Read

  • How do you implement multiple payment gateways in iGaming platforms?
    11 minutes

    How do you implement multiple payment gateways in iGaming platforms?

    Implementing multiple payment gateways in iGaming platforms involves integrating several payment processors to offer diverse payment options, ensure regulatory compliance, and maximise transaction success rates. This approach requires careful technical planning, strong security measures, and intelligent routing systems. The process typically involves API integrations, database management, and thorough testing to create smooth payment experiences for…

    Read

  • 1 minute

    Development of export activity on new foreign markets

    White Label Coders sp. z o.o. has received EU co-funding for the project “Development of export activity on new foreign markets”. The support, in the form of an export voucher, comes from the project “InterGlobal – internationalisation of SMEs from the Silesian Voivodeship”, implemented by Fundusz Górnośląski S.A. under the European Funds for Silesia 2021–2027…

    Read