I wonder how this scales when you have multiple databases, or have read-only slaves, or something like that.
Then developers have to remember to send some traffic to localhost:3306 and some traffic to localhost:3307, and who knows how many more ports.
Documentation never manages to stay up-to-date, so perhaps you could use some sort of Service Discovery Protocol to map these semi-arbitrary numbers to more memorable names.
Then, as long as you know what port the service-discovery-service runs on, you could simply query it for the address to reach your databases.
Maybe that's too much work, though. We could just stuff everything in /etc/hosts.