Multiple WordPress Installation Using a Single Database

Hi all,
Here I explain how to install multiple wordpress in a single database. If you want multiple sites, multiple theme in one database. You must install WordPress manually in order for this to work. Most one click programs like Fantastic would not let you choose the prefix.

Multiple Blogs Through Multiple Installs

We can develope the multiple wordpress site with multiple database. System architecture can be divided into two types by number of databases.

  1. Multiple databases installation. The each database manage site’s information.
  2. Single database installation. The database manages all site’s information into one database .

Multiple Databases

You’ll need a separate MySQL database for each blog you plan to install.The wp-config.php file will vary for each installation. The lines to change are:


DB_NAME will be the name of the individual database created for that blog. If you are using different user logins for each database, edit DB_USER and DB_PASSWORD to reflect this, as well.

Single Database

In above, explain we can use multiple wordpress site with multiple database access. But in here how to use multiple wordpress sites with single database.
In this case, only one line will be unique in each blog.

$table_prefix = 'wp_'; // example: 'wp_' or 'projects' or 'mylogin_' or 'test'

Edit the wp-config.php page like this:

table_prefix = ‘wp1_’;
table_prefix = ‘wp2_’;
table_prefix = ‘wp3_’;

By default, WordPress assigns the table prefix wp_ to its MySQL database tables, but this prefix can be anything you choose. By using more than one, you create unique identifiers for each blog in your database. For example, let’s say you have three blogs to set up, with the names Main, Projects and Test. You want to substitute the prefix wp_ for each blog’s wp-config.php:

Main blog:

$table_prefix = 'main_';

Page blog:

$table_prefix = 'page_';

Test blog:

$table_prefix = 'testing_';

That is all you really need to do. This is also a security measure that you can take even if you don’t have to install multiple installation. By having a prefix, you are making the hacker work more to find out what is the SQL Address before he can hack.

If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Leave a Reply

Your email address will not be published. Required fields are marked *