Re: MySql Port
Have you tried adding colon port to the host specification in local.php? as in "host:port"? I don't know if it will work, but it is the first thing I would try.
Further to that, I would examine the database connect code in php files that include local.php, by grepping for the host variable usage - you may get a clue from that and a php API reference.