How to have a multiple installation of WordPress with in one single database ?

Get Latest WordPress & Blogging Tips in Your Inbox:

WordPress is powered by PHP/MySQL and thus it needs a MySQL database. There are many web hosts who restrict you from creating unlimited database and thus puts you in a trouble of managing the web sites accordingly. Of course, I’ll always suggest you to do a thorough research on choosing the web host, however, if you are stuck with any web host which restricts you then also you are not out of luck. Fortunately, multiple WordPress can be run using a single database instance.


How to have two or more WordPress installation in single database ?

By default, WordPress prefixes WP_ to it’s mysql tables (this may sound really technical, but don’t worry about it much) and it allows you to even change that and that’s where we can make use of this setting to ensure that we can run multiple copies of WordPress on a single database.

If you have done a manual installation of WordPress, then you’ll know about wp-config.php file. This file allows you to change the table prefix and thus allows you to run multiple copies. In order to achieve the same you have to follow the normal installation procedure and in addition to that you just have to do the following steps as well (this needs to be done before running the installer) -

1. Open wp-config.php
2. Look for a line which says – table_prefix = ‘wp_’;
3. Replace wp_ with anything you want. for e.g. it may look like this as well – table_prefix = ‘blog2_’;
4. Save the file
5. Run the installer

CAUTION – You have to do the above steps before running the installer!

I hope this little nifty tip will help you in ensuring that you don’t change your web host just because they don’t allow extra database to run.

5 Responses so far  |  

  1. ScorpFromHell October 3rd, 2008 at 4:04 pm
  2. Well you could also use wordpress mu to do a multibog installation.

  3. Ajay Pathak October 5th, 2008 at 7:28 am
  4. as i see multiple installation means multiple blogs. so this solve the problem of database size ?

  5. mayank October 6th, 2008 at 11:35 am
  6. @scorpfromhell – Yes you can use WP MU for multiblog installation. however, not everyone is that comfortable with WP MU. And guess what, our upcoming blog post talks about how you can have multiple blogs with WordPress.

    @Ajay – Well, I don’t think it should be a problem. I will only suggest this in case your webhost doesn’t allow you to create more database or if you have already achieved the limit.

  7. How To Install Multiple Wordpress Blogs In One MySQL DataBase. | BloggingBandit November 6th, 2008 at 4:59 pm
  8. [...] start a second blog you most probably cannot because the basic hosting plan allows only 1 DataBase.Mayank suggest a work around to install multiple wordpress installations on 1 MySQL [...]

  9. kiana December 7th, 2008 at 4:30 am
  10. what if you have already install wordpress and have decided that you want to add multiple blogs in your single database? could i just go back in and change the config.php again? or is it too late now? please email me back at your earliest. thank you.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>