手册:$wgDBserver

From mediawiki.org
This page is a translated version of the page Manual:$wgDBserver and the translation is 86% complete.
数据库设置: $wgDBserver
数据库服务器主机名或 IP 地址。
引进版本:pre 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的配置。
On Windows, having MySQL as the backend, some users report that using localhost for the server name instead of 127.0.0.1 increase the time to connect to the database a lot. So, in windows, it's recommended to use 127.0.0.1 instead of localhost if MySQL is on the same machine. See this forum thread.

参见

  • $wgDBservers - for multiple-server (primary/replica) setups or users of custom certificates for SSL encryption where $wgDBssl does not work.