Manual:$wgDBprefix
Appearance
From mediawiki.org
Languages:
| Database settings: $wgDBprefix | |
|---|---|
| Table name prefix. |
|
| Introduced in version: | 1.4.0 |
| Removed in version: | Still in use |
| Allowed values: | (string) |
| Default value: | '' |
| Other settings: Alphabetical | By function | |
Details
[edit ]Table name prefix. This should be alphanumeric, contain neither spaces nor hyphens, and end in "_". If you only have access to a single database and wish to install more than one version of MediaWiki, or have other applications that also use the database, you can give the table names a unique prefix to stop any naming conflicts or confusion.
For example, if you use the prefix 'wiki_' then the table 'page' will be named 'wiki_page' instead.
You need to set this at the time of initial configuration, or manually change the table names at a later date. Changing this setting does not automatically update the names of the tables in your database.
This setting is NOT used if your database is PostgreSQL: instead, schemas are used (see
$wgDBmwschema ).[1] Common value
[edit ]Many installers set the database table prefix "$wgDBprefix" to "mw_" by default.[2] [3] [4]
Caution! Caution:
- Do not change
$wgDBmwschemaafter Setup.php has been included. Note: Setup.php initializes various paths, includes some common files, starts sessions, and performs various other setup tasks for a request. It is not related to the installation or setup of MediaWiki. - Only files in
includes/db/should use$wgDBmwschema, while everything else should use the dbSchema() method provided by theWikimedia\Rdbms\IDatabaseinterface or extract it from thegetDomainId()method in either theWikimedia\Rdbms\ILoadBalanceror theWikimedia\Rdbms\ILBFactoryinterface. TheDatabaseDomainclass can extract such components from a database domain ID. - If you configure
$wgDBserversor$wgLBFactoryConf, you still need to define$wgDBname,$wgDBmwschema(if applicable for the DB type), and$wgDBprefix(if applicable for the DB type). The combination of$wgDBname,$wgDBmwschema, and$wgDBprefixdefine the current wiki's database domain. This is also called the local database domain. The 'dbname' and 'tablePrefix' settings in$wgDBserversand$wgLBFactoryConfonly define the default DB/prefix when a connection is requested withDatabaseDomain::newUnspecified()->getId()(the empty string) as the database domain, e.g.wfGetDB( DB_REPLICA, [], '' ). Note that functions calls likewfGetDB( DB_REPLICA ), which simply omit the database domain, are assumed to refer to the local database domain.
References
[edit ]- ↑ Reminder: Don't set $wgDBprefix when you're using Postgres, 2020年05月18日
- ↑ Mark S. Choate. "Professional Wikis". p. 34.
- ↑ Daniel J. Barrett. "MediaWiki: Wikipedia and Beyond". p. 186.
- ↑ "Table prefix for db tables".
See also
[edit ]- Database field prefixes
- Manual:SQL patch file , where
/*_*/is used for$wgDBprefix