Benjamin Lees wrote:
$wgDBname controls which database is used; you should usually set it in AdminSettings.php for maintenance scripts. You will have to set it to your first database and run update.php, then set it to your second database and run update.php, and so on (barring a more elegant method).
FWIW, my preference was to not symlink the maintenance directories and have a separate one for each wiki. Then I set up a unique AdminSettings.php in each wiki's root (renamed when not in use for minimal security). The duplicate directories need only contain the single script of interest (with all scripts in main maintenance directory in the otherwise symlinked dir structure).
This way I can run scripts without thinking too hard about making sure precisely which wiki/db the script runs against.
Mike