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 18:03:31 UTC 2012

On 15/01/2012 17:50, Paul Beard wrote:
> The app configurations are not this granular: hostname and port are
> configured but there is nothing that makes clear that IF you specify
> localhost, you WILL BE using a domain socket which MUST BE
> /tmp/mysql.sock and IF you move it or your distribution prefers some
> other location you MAY NOT use localhost as you are now using a TCP
> socket which shouldn't require a hostname but because of the way the
> app is written, it does.

You can specify an alternate socket location in your connection
parameters.  For the command line client, it is:

   mysql -S /var/run/mysql/sock

This doesn't help if you say 'mysql -h localhost' and get diverted to
use the default socket though -- in that case you can have a .my.cnf
file containing (inter-alia)

   socket = /var/run/mysql/sock

For the various language APIs, you generally need to specify a DSN
string -- usually this looks something like


but for a socket connection you could say instead:


... assuming that whoever wrote the application you're using made it
sufficiently flexible as to be able to accept something like that.



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