Jump to content

Manual:$wgDBserver

From mediawiki.org
This page is a translated version of the page Manual:$wgDBserver and the translation is 53% complete.
Outdated translations are marked like this.
Настройки базы данных: $wgDBserver
Хост или IP-адрес базы данных.
Введено в версии:Before 1.1.0
Удалено в версии:всё ещё используется
Допустимые значения:(строка)
Значение по умолчанию:'localhost'

Подробнее

Имя хоста базы данных или IP-адрес. Ищите в $LocalSettings.

If you are using MySQL on a non-standard port, you can use the 'hostname:port'-syntax, for example $wgDBserver = '127.0.0.1:3308';. Обратите внимание, что использование номера порта в случае, если Вы указали имя хост-узла как localhost не сработает, поскольку вместо этого MySQL подсоединится через разъём центрального процессора. If the MySQL server is on the same server and you want to connect through a socket in a non-standard location, you can use the 'localhost:socket'-location, for example $wgDBserver = 'localhost:/var/run/mysql/mysql.sock';.

Когда это возможно, используйте IP-адрес, чтобы избежать потребление ресурсов DNS-поиска при каждом подключении к Вики. $wgDBserver = '000.000.000.000'; будет быстрее, чем $wgDBserver = "wiki.example.org";
$wgDBport только для конфигурации PostgreSQL.
Некоторые пользователи, имеющие сервер MySQL, сообщали, что использование имени сервера localhost вместо 127.0.0.1 при использовании Windows значительно удлиняло время подключения к базе данных. Поэтому в случае, если MySQL расположен на одном устройстве с Windows, рекомендуется использовать $ip2 вместо $localhost2. Смотри this forum thread. 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.