Make MySQLi work with non-standard port

Other than mysql_connect, mysqli_real_connect expects an explicit
port parameter. So we need to parse the port out of $realServer. Note it
is not possible to just use $wgDBport, since that is set to 5432 as a
default and would break all existing sites using mysqli on standard port.

This change is IPv6 safe.

Bug: 58153
Change-Id: I58e690ef2803e205f324a142fbcbd96cc87510f1
Merge "Make MySQLi work with non-standard port" into REL1_22