Thread:Project:Support desk/Can't connect to my remote MySQL database that uses a custom port/reply (4)

I've tested that on 1.22.7 and I can confirm that $wgDBserver works with a port in $wgDBserver.

But also note that a port number won't work if you specify  as the host name. Using  as the host name uses the socket, ignoring the specified port number (if any).