My LocalSettings.php looks like this:
```lang=php
$wgDBservers = array(
array(
'host' => 'blah',
'dbname' = > 'mediawiki',
...
),
);
```
I was not setting $wgDBname and this was working in MediaWiki 1.30.0. After upgrading to MediaWiki 1.32.0 I got DB connection errors because LoadBalancer.php was trying to connect to dbname "my_wiki". This is the default value from includes/DefaultSettings.php. This seems like incorrect behavior to me. Based on my reading of https://www.mediawiki.org/wiki/Manual:$wgDBservers I would expect $wgDBname to be ignored if $wgDBservers is specified.
As a workaround, I can confirm that setting $wgDBname = "mediawiki" in my LocalSettings.php causes things to work again.
I did only a small amount of debugging and it appears that on this line: https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/libs/rdbms/loadbalancer/LoadBalancer.php;de383fe4e41aff1463264bc420be055e257b1397$924
$server contains the good values that I want to use (the correct DB name--"mediawiki").
And $this->localDomain contains the incorrect value that I think should not be used ("my_wiki").
Related but different: I had a similar situation using $wgDBservers in 1.30.0, where I was forced to define $wgLocalDatabases even though $wgDBservers was defined: https://phabricator.wikimedia.org/T193832
And maybe this line is overwriting the good value with the bad value: https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/libs/rdbms/loadbalancer/LoadBalancer.php;de383fe4e41aff1463264bc420be055e257b1397$1113
I'm not familiar with the MediaWiki source code at all and I don't understand what the intent is here, but it seems fishy.
It's not immediately obvious to me what changed between MediaWiki 1.30.0 and 1.32.0 that might have caused this, but these two commits might be relevant:
- rMW14ee3f2107826495b8ef0d50e0340394bf28c92d
- rMWa3160ceeba58961c29d977717c58b41d2a7a0360
Assigning to aaron because it looks like he has worked on this code recently and might be familiar with it.