My LocalSettings.php looks like this:
$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: 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:
Assigning to aaron because it looks like he has worked on this code recently and might be familiar with it.