Jump to content


From mediawiki.org
This page is a translated version of the page Manual:$wgDBserver and the translation is 24% complete.
Outdated translations are marked like this.
Configurações da base de dados: $wgDBserver
Host name or IP address of database server.
Introduzida na versão:before 1.1.0
Removida na versão:ainda em uso
Valores permitidos:(string)
Valor por omissão:'localhost'


Database host name or IP address. Found in LocalSettings.php .

If you are using MySQL on a non-standard port, you can use the 'hostname:port'-syntax, for example $wgDBserver = '';. Note that using a port number when you specify localhost as the host name will have no effect, as MySQL will connect through a socket instead. 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';.

Use IP addresses where possible to avoid the overhead of a DNS lookup for every single connection to the wiki. $wgDBserver = ''; will be faster than $wgDBserver = "wiki.example.org";.
$wgDBport is only for PostgreSQL configuration.
On Windows, having MySQL as the backend, some users report that using localhost for the server name instead of increase the time to connect to the database a lot. So, in windows, it's recommended to use instead of localhost if MySQL is on the same machine. See this forum thread.

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.

Ver também

  • $wgDBservers - * $DBservers: para configurações de múltiplos servidores (master/escravo).