Run Multiple WordPress Sites With One User Database
July 29th, 2016 | by Ravi Chahar || Leave a comment |
Do you run multiple websites on the same web hosting server? Have you ever thought what would you do if you have only one database? Can you add multiple WordPress sites on one database? Well, the answer is yes you can. In this post, I am going to tell you how to use one database for twoWordPress sites.
The limit isn’t two, you can add as many websites as you want with the one database. Many web hostings don’t provide more than one database. So, in such situation, you should know how to add more websites using the same database for all.
How To Run Multiple WordPress Sites on One Database?
You install the WordPress manually for your first website. You may notice the table prefix is by default “wp_‘. You would be glad to know that it can be changed. If you want to run another website with the same database then you should change the table prefix while installing the WordPress.
Just change it anything you want. You can change it with “website1_” and then install you first website. And after that you wish to add another site then you have to choose the different table prefix. Suppose “website2_”.
From the security point of view, it’s better to have the different table prefix for the database of your website. Before doing any change in your website, you should have the backup of your website and the database.
Step By Step Guide To Add Multiple Websites With One user Database.
Step 1:- While installing the WordPress for your first website, change the table prefix as shown above. You can name it anything you want.
Step 2:- Similarly, when you do the second installation on your second domain, then use the different table prefix.
Step 3:- You have to add the code in the “wp-config.php” file of the main website.
How would you add another website if you have alraedy installed the WordPress with the default table prefix? There is another solution for this problem.
How To Use One database For two WordPress Sites?
Step 1:- If you installed the WordPress using the default table prefix “wp_‘ for your first website. Now is the turn to install another WordPress. You can do that by just uploading the WordPress zip file in the WordPress directory.
Make sure that you add in the subfolder. It’s the same as to add an another website. Extract the WordPress in the subfolder.
Step 2:- Two WordPress files are present on your web hosting. The first one is in the root directory and another one is in the subfolder you have just created in the root directory.
Step 3:- The problem is about the table prefix here. You have to change it for each of the WordPress installation. It’s very simple. You just go find the “wp-config.php” file in each WordPress directory and change the “$table_prefix” value from “wp_” to anything.
Make sure that you choose different table prefix for each WordPress installation. After editing the file just open your new domain and complete the WordPress installation.
Have You Ever Thought About Adding Multiple WordPress Sites on One database?
You create the database from your cPanel but have you ever thought about using one database for many websites? It’s not a new theory, you can try it your own. Many people face the problem when they want to add multiple websites but have only one database.
Well, they should be happy to know that it’s possible to run multiple WordPress sites with one user database. The simple thing to do is the change in the table prefix. You can replicate as many websites you want from the single installation. The thing is to edit the “wp-config.php” file from the WordPress directory.