Manual talk:$wgSharedDB

From mediawiki.org
Latest comment: 1 year ago by FreedomFighterSparrow in topic Wrong deprecation message?

That's a useful setting! But the project's tables might have a prefix!

For instance, I would like to have two projects in the same database with a single sign-on and I have to use prefixes for both of them (because my provider gave me only one database, and I have other tables in it) -- how can I configure MediaWiki for that?

I have a similar problem. I have a project with multilingual system, but I want to permit only-one-register for all users (you register on commons project and have access for all other wikis installed in the same domain/server) Could anybody help us? Thanks - estemon
If all wikis are set to use the same cookie domain, a user shouldn't have to login separately. Jschroe 17:39, 19 July 2007 (UTC)Reply

preselected db-users[edit]

Hello! My provider gave me two preselected databases and preselected users. I've got a german wiki about a dialect. Let's say that the first database's name is "mainwiki" - this is the database for the image-pool - than the second's name is "mainwiki_ma". The user names are then:

for database "mainwiki": "mainwiki"
for database "mainwiki_ma": "mainwiki_ma"

I can't change this, so $wgSharedDB doesn't work for me, because the current db-user needs readaccess to the shared database, but this isn't possible. What can I do, that this works? Please help!


I have the same problem. Is there any workaround or extension for using a different user and password for the shared database in $wgSharedDB?
I guess many people have similar problems using MediaWiki on shared hosting systems with restricted access to their database configuration.
Many Thanks! --SvenT 08:49, 14 October 2009 (UTC)Reply
No, this isn't possible. MediaWiki may need to join the shared table against another. If you have to log in separately, it can't do that. Mr.Z-man 17:54, 14 October 2009 (UTC)Reply

I need an example[edit]

I am sorry that I need an example to follow. My project have 3 languages so I set up 3 wikis. I want to have single user registration. The configuration details are:

wikiName / database / databaseUser / tablePrefix
1. cnwiki / cnwiki / wpc / wpc_
2. enwiki / enwiki / wpc / wpc_
3. hkwiki / hkwiki / wpc / wpc_

Since hkwiki will be the most popular one, I would like to make it the shared database.

LocalSettings.php for cnwiki

//SharedDB
$wgSharedDB = 'hkwiki';
$wgSharedTables = array( 'user', 'user_groups', 'interwiki');
$wgSharedPrefix = 'wpc_';

LocalSettings.php for enwiki

//SharedDB
$wgSharedDB = 'hkwiki';
$wgSharedTables = array( 'user', 'user_groups', 'interwiki');
$wgSharedPrefix = 'wpc_';

LocalSettings.php for hkwiki

//SharedDB
$wgSharedDB = 'hkwiki';
$wgSharedTables = array( 'user', 'user_groups', 'interwiki');
$wgSharedPrefix = 'wpc_';

Then I have error message when I created an user. Can anyone help to correct my settings? Many thanks!

What error message? Mr.Z-man 17:55, 14 October 2009 (UTC)Reply

Doesn't work on one wiki[edit]

I have 3 wikis:

  • wiki-pool with shared DB; MW 1.22.0
  • wiki1; MW 1.21.3
  • wiki2; MW 1.21.3

Wiki1 and wiki2 have a similar configuration, the same version but different installation history. Wiki-pool is freshly installed. In LocalSettings.php on wiki1 and wiki2 I have:

$wgSharedDB = 'wiki-pool';
$wgCookieDomain = '.domain.tld';
$wgSharedTables = array('user', 'user_groups', 'interwiki');
$wgSharePrefix = '';

When I'm logged on wiki-pool I'm also logged into wiki1 but not wiki2. When I try to log on wiki2 get:

Login error
Incorrect password entered. Please try again. 

In Firefox Preferences → Privacy → Show Cookies I see cookie wiki-poolUserName with my loginname. Where I can look why this Where can I find why it does not work? --Dracorp (talk) 14:22, 17 December 2013 (UTC)Reply

Wrong deprecation message?[edit]

Looking at the original (2012!) deprecation, it seems like only use in code was deprecated, and it's fine to use this in settings. This means the 'This deprecated feature should no longer be used' warning is wrong. Am I mistaken? FFS Talk 21:19, 23 September 2022 (UTC)Reply