database apps that ignore sockets? [was: Solution: mysqld fails to run, can't create/find mysql.sock]

Matthew Seaman m.seaman at
Sun Jan 15 17:53:15 UTC 2012

On 15/01/2012 17:20, Chuck Swiger wrote:
> If you specify a hostname and port via "--host=localhost
> --port=3306", then you are describing a TCP socket.  There is no
> pathname involved.  You could connect regardless of where mysqld is
> putting the socket.

Some MySQL clients will gratuitously change a connection attempt to
localhost to use the /tmp/mysql.sock unix domain socket because it does
perform a bit faster, and it seems they don't expect their users to just
ask for a socket connection explicitly.  You can test this fairly
simply: set up your server with 'skip-networking' temporarily and try
making client connections to it.

Of course, for some language API's there's no option but to use a
network socket -- Java being a case in point -- but that's the exception
rather than the rule.

To force the command line mysql(1) client to use a network connection to
localhost you need to use the --protocol=TCP argument



Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP:     Ramsgate
JID: matthew at               Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url :

More information about the freebsd-questions mailing list