How to run multiple WordPress installations using the same MySQL Database

Have you ever wondered whether its possible to host multiple WordPress installations in one database or not – well I’m here to tell that it’s very possible. (Now give me a big smile 🙂 )

There can be many benefits of hosting multiple WordPress installations on the same MySQL database. Usually hosting providers have a limit of how many databases you are allowed to create with their service particularly when you are on a shared server. Sometimes it’s quite hectic to maintain lots of databases. You may even probably want to keep all the same niche websites under the same database name.

 

Whatever the reason, you are on track if you are wanting to use lots of  WordPress websites under one database.

 

All it takes is a small change to the wp-config.php file for your blog. Take a look at the screen shot of a wp-config.php file:

Notice the highlighted area. By default the value of $table_prefix is ‘wp_’.

You can set this value to anything you want. The trick is to do this before you install WordPress. If you set the prefix to something which is specific to the blog that you are installing, then WordPress will automatically create the tables for that blog with the proper prefixes.

This allows you to install as many blogs as you want on the same database. So, if you wanted to install another blog on this database, you would simply give another prefix to the second blog.

I use this method all the time. Because when I do this, I don’t need to backup each blog individually. I simply backup one single database and all my blogs get backed up.

Note, this shouldn’t be confused with WordPress MU, which is totally different CMS concepts all together. This is for installing WordPress single user, but multiple instances of it.

Now see how you go doing it! Don’t forget to give us some feedback on this article!

Similar Posts

One Comment

  1. Very nice tips. Very helpful for setting up lots of website with one DB. Cool! Thanks for the share

Comments are closed.