Share user database tables between two WordPress installations
One database, one user list, two blogs
In a recent project, I found myself having to share user tables between two separate WordPress installations. This is common in multi-lingual websites, but might just come in handy for you as well. I am assuming you already have a WordPress installation in place and are now installing a second one. You’ll need to open your first WordPress installation’s config.php file and copy the database configuration and paste it into the second. This allows both installations to use the same database.
Now we need to make sure that we don’t overwrite our content, so we’ll change the $table_prefix value to something unique like “wp2″.
$table_prefix = 'wp2_';
All we need to do now is grab the user tables by adding the following lines. This is assuming you left the tables prefix to “wp” when you installed WordPress the first time around.
define('CUSTOM_USER_TABLE', 'wp_users');
define('CUSTOM_USER_META_TABLE', 'wp_usermeta');
Done. Install as usual and enjoy your shared user tables.
Notice
It’s been brought to my attention that by using this method, you would be unable to log in to the second installation by using the default administrator login. I’m looking at work-around solutions but for the time being, you should be able to create a new user with admin access that could exploit both installations.

johntra
August 16, 2010 at 2:35 PMhttp://www.steelfrog.com/share-user-database-tables-between-two-wordpress-installations/#comment-189
Hi, any idea how to share all tables except options – can we just use other table names for this?
Steel Frog
August 17, 2010 at 8:43 AMhttp://www.steelfrog.com/share-user-database-tables-between-two-wordpress-installations/#comment-196
Good question. I’m sure there must be a way to exclude the wp_options table, but since I’m not very comfortable with SQL connection strings, I unfortunately can’t answer that question for you.
There are no “built in” options from WordPress that I could find. Maybe check WordPress’ multiple blog page?
cdtoad
August 21, 2010 at 1:41 AMhttp://www.steelfrog.com/share-user-database-tables-between-two-wordpress-installations/#comment-237
This won’t work. One of the two blogs will then not let you in as admin.
Steel Frog
August 23, 2010 at 12:49 PMhttp://www.steelfrog.com/share-user-database-tables-between-two-wordpress-installations/#comment-252
I’m not sure why it wouldn’t work, as I’ve used this technique several times in the past when working on re-designs. Could you emphasize?
adan
September 14, 2010 at 9:28 AMhttp://www.steelfrog.com/share-user-database-tables-between-two-wordpress-installations/#comment-335
Trying to login from “shared user” blog using “master” user and usermeta table… after login… it shows this
“You do not have sufficient permissions to access this page”
Steel Frog
September 14, 2010 at 9:31 AMhttp://www.steelfrog.com/share-user-database-tables-between-two-wordpress-installations/#comment-336
What happens when you create a new admin account and then try to log in? It worked without a hitch the last time I tried it, but WordPress may have changed its routines since.