Learn how to a build a cloud-first strategyRegister Now


Run two wordpress sites from the same database - same content

Posted on 2012-09-19
Medium Priority
Last Modified: 2012-09-19
Hi, ive scoured the web looking for this answer but there seesm to be nothing up to date. I have a web portfolio running on wordpress which i want two themes for. I thought it would be easy to have two installs and change the theme on one. Duplicating the tables (wp_options) was easy but i have no idea how to tell the second installation to use the new table ( which points to the new folder) - I started making a tutorial to help others (http://ahimsa-creative.com/ahimsa_collective/AC2011/helpers/wordpress/run-two-sites-from-the-same-database/ ) from the other tutorials i saw on the web, but the last step cannot be done as the code in wordpress has changed...

Anyone know an easy way to have two wordpress installations running from the same database? or is there an easier way to have switchable themes
Question by:ahimsalove
  • 2
  • 2
LVL 70

Expert Comment

by:Jason C. Levine
ID: 38416123
You can do this on the sly using MySQL federated tables:


The flow would go somewhat like this:

1) Create WP site #1 in database 1
2) Create WP site #2 in database 2 using the same table prefix as #1 (if using prefixes)
3) Drop all the tables in database 2 EXCEPT wp_options
4) Run the appropriate CREATE TABLE commands using the federated storage engine per the instructions at http://dev.mysql.com/doc/refman/5.0/en/federated-use.html on all of the WP tables in database 1 except wp_options.

At the end of those steps, you would have all of the content and user and meta tables replicated on both databases but independent wp_options tables.  That should allow you to define different themes.

Your linked article involves hacking the WP core files (specifically wp-settings.php) and anyone following it would lose all of the changes on the next WordPress update.

Author Comment

ID: 38416172
Thanks for the advice. How does one make federated tables... I read about them and it says they need to be on different servers? Is there an easier way to have two themes running on wordpress? seems like a lot of work for a seemingly simple task. Im still extremely new to mySql and all the fact that it all happens with commands is kind of scary.

I read one article that said to try these two plugins - theme switcher and theme preview. Both are outdated though and i havent tried them yet. Would that be a better way to switch themes on the fly.... ?

thanks a lot
LVL 70

Accepted Solution

Jason C. Levine earned 2000 total points
ID: 38416350
How does one make federated tables

One reads the second link I provided which explains the command syntax in great detail.  You should be able to run in on the same server as long as you have different databases.  If all tables are in the same database, you're going to be forced to MySQL Table Replication and that's not a good place to be.

Is there an easier way to have two themes running on wordpress?

You can use a plugin but that's really meant to give a site a user-choosable skin experience and not really germane to what you are trying to do by having one database power two sites.  Check this plugin out:


Another reason people don't spend a lot of time worrying about this is that the new Panda/Penguin rules at Google will absolutely murder both sites for posting identical content.

Author Closing Comment

ID: 38416461
Thanks a lot...  yes i had heard about the google thing but hadnt really factored it in that much.. Thanks for reminding me. It my personal portfolio site, so i dnt need a good google ranking, but better it play it safer... ill try the plugin and hope it goes well... thanks a lot

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question