手册:$wgDBserver
Outdated translations are marked like this.
数据库设置: $wgDBserver | |
---|---|
数据库服务器主机名或 IP 地址。 |
|
引进版本: | 1.1.0前 |
移除版本: | 仍在使用 |
允许的值: | (字符串) |
默认值: | 'localhost' |
其他设置: 按首字母排序 | 按功能排序 |
详情
数据库主机名称或IP地址。在LocalSettings.php 找到。
如果你在MySQL上使用一个非标准端口,你可以使用'hostname:port'
句法,例如:$wgDBserver = '127.0.0.1:3308';
。
注意,当指定localhost
作为主机名时使用端口号将不起作用,因为MySQL将通过套接字进行连接。
如果您的MySQL服务器在同一台服务器上,并且想通过非标准位置的套接字进行连接,您可以使用"localhost:socket",例如:$wgDBserver = 'localhost:/var/run/mysql/mysql.sock';
。
请尽可能使用IP地址,避免与每个与wiki的连接产生的DNS查找开销。
使用
$wgDBserver = '000.000.000.000';
将比使用$wgDBserver = "wiki.example.org";
更快。$wgDBport
只适用于PostgreSQL的配置。在Windows上使用MySQL作为后端时,一些用户报告使用
localhost
而非127.0.0.1
作为服务器名称会大大增加连接数据库的时间。因此,在Windows中,建议当MySQL在同一机器上时使用$ip2而非$localhost2。 So, in windows, it's recommended to use 127.0.0.1
instead of localhost
if MySQL is on the same machine. See this support desk post.It may not work with plain IPv6 addresses, depending on the MySQL driver (libmysqlclient or mysqlnd); this is linked to this PHP bug.
Also, when $wgDBssl
is used, IPv6 addresses in the field subjectAlternativeName of a certificate are not recognised (it was not implemented in PHP when the verification of IPv4 addresses in certificates was implemented [1]).
A workaround for these both cases is to use a DNS name pointing to an IPv6 address.
参见
- $wgDBservers - for multiple-server (primary/replica) setups or users of custom certificates for SSL encryption where $wgDBssl does not work.