Manual:$wgSharedDB

Details
The name of the shared database.

Shared database for multiple wikis. Commonly used for storing a user table for single sign-on (actually not real SSO, since the user may still have to log in into each wiki separately, but at least registration has to be done only once). The server for this database must be the same as for the main database. From 1.13 on you may use $wgSharedPrefix to specify a separate prefix for this database.

Read Access
Make sure that the database user you set in $wgDBuser has read-access to that database. It might be sufficient to grant read-access to the user table only.

Table Prefix
The databases needs to have matching (or no) table prefixes in order to work (tested with 1.9.1 towards 1.8.2).

Table Prefix Hack
To enable the use of a shared usertable on a database that is already shared using different prefixes for each installation of MediaWiki you will need to manually edit the tableName function in Database.php under the includes folder to look like this:

You will then need to set the variables $wgSharedDB and $wgSharedDBUserTable in your LocalSettings.php file. It is also advisable to define $wgSharedDBUserTable after $wgSharedDB on line 571 of DefaultSettings.php


 * EXPERIMENTAL!

Alternative solution for multiple tables:

In LocalSettings.php: