Manual:$wgDBname

From Linux Web Expert

<translate> Database settings</translate>: $wgDBname
Name of the database.
<translate> Introduced in version:</translate>pre 1.1.0
<translate> Removed in version:</translate><translate> still in use</translate>
<translate> Allowed values:</translate>(string)
<translate> Default value:</translate>'my_wiki' (1.14+)
'wikidb' (pre-1.1.0 - 1.13)

Details

Name of the database used by current installation of MediaWiki.

File:OOjs UI icon alert-destructive.svg <translate> Caution:</translate>
  • <translate> Do not change <tvar name=1>$wgDBmwschema</tvar> after <tvar name=2>Setup.php </tvar> has been included.</translate> <translate> Note:</translate> <translate> <tvar name=1>Setup.php </tvar> initializes various paths, includes some common files, starts sessions, and performs various other setup tasks for a request.</translate> <translate> It is not related to the installation or setup of MediaWiki.</translate>
  • <translate> Only files in <tvar name=1>includes/db/</tvar> should use <tvar name=2>$wgDBmwschema</tvar>, while everything else should use the <tvar name=3>dbSchema()</tvar> method provided by the <tvar name=4>Wikimedia\Rdbms\IDatabase</tvar> interface or extract it from the <tvar name=5>getDomainId()</tvar> method in either the <tvar name=6>Wikimedia\Rdbms\ILoadBalancer</tvar> or the <tvar name=7>Wikimedia\Rdbms\ILBFactory</tvar> interface.</translate> <translate> The <tvar name=1>DatabaseDomain</tvar> class can extract such components from a database domain ID.</translate>
  • <translate> If you configure <tvar name=1>$wgDBservers</tvar> or <tvar name=2>$wgLBFactoryConf</tvar>, you still need to define <tvar name=3>$wgDBname</tvar>, <tvar name=4>$wgDBmwschema</tvar> (if applicable for the DB type), and <tvar name=5>$wgDBprefix</tvar> (if applicable for the DB type).</translate> <translate> The combination of <tvar name=1>$wgDBname</tvar>, <tvar name=2>$wgDBmwschema</tvar>, and <tvar name=3>$wgDBprefix</tvar> define the current wiki's database domain.</translate> <translate> This is also called the local database domain.</translate> <translate> The '<tvar name=1>dbname</tvar>' and '<tvar name=2>tablePrefix</tvar>' settings in <tvar name=3>$wgDBservers</tvar> and <tvar name=4>$wgLBFactoryConf</tvar> only define the default DB/prefix when a connection is requested with <tvar name=5>DatabaseDomain::newUnspecified()->getId()</tvar> (the empty string) as the database domain, e.g. <tvar name=6>wfGetDB( DB_REPLICA, [], '' )</tvar>.</translate> <translate> Note that functions calls like <tvar name=1>wfGetDB( DB_REPLICA )</tvar>, which simply omit the database domain, are assumed to refer to the local database domain.</translate>

See also

  • Manual:Database access – contains an overview of working with databases and database engines in MediaWiki.
  • all.dblist - full list of database names used in Wikimedia servers