see also:
http://bugs.mysql.com/bug.php?id=44824

and specifically:

http://dev.mysql.com/doc/refman/5.1/en/mysql-real-connect.html

ideally if none of the user/port/socket are specified, we should use the mysql configuration file as our default method.