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
defalt and would break all existing sites using mysqli on standard port.

This change is IPv6 safe.

Bug: 58153
Change-Id: I8fe191b930b26bce3c863b1953b237cb4a889c6e
Merge "Make MySQLi work with non-standard port"