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.