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)
[client]
socket = /var/run/mysql/sock
For the various language APIs, you generally need to specify a DSN
string -- usually this looks something like
mysql:database=$database;host=$hostname;port=$port
but for a socket connection you could say instead:
mysql:database=$database;mysql_socket=/var/run/mysql/sock
... assuming that whoever wrote the application you're using made it
sufficiently flexible as to be able to accept something like that.
Cheers,
Matthew
--
Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard
Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
JID: [email protected] Kent, CT11 9PW
signature.asc
Description: OpenPGP digital signature
