Date: Sun, 15 Jan 2012 18:03:26 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: freebsd-questions@freebsd.org Subject: Re: database apps that ignore sockets? [was: Solution: mysqld fails to run, can't create/find mysql.sock] Message-ID: <4F1314EE.6010404@infracaninophile.co.uk> In-Reply-To: <4F952937-843B-4E38-B168-4E1720555D89@gmail.com> References: <0F82362E-2694-4EBC-B019-DE2F2C160D45@gmail.com> <7325D262-C6EB-42DB-870D-D3E2FAC9D0C1@mac.com> <1954AA20-BE6F-4F04-A770-49ECFA405B5D@gmail.com> <3D14230E-7E8A-4E35-8161-F5F9CB74C83C@mac.com> <3720E228-67EE-4F44-B828-AFA0125D2A54@gmail.com> <0E0B740B-4E2C-41C8-A8A4-BC92DC0D7089@mac.com> <4F952937-843B-4E38-B168-4E1720555D89@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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: matthew@infracaninophile.co.uk Kent, CT11 9PW
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk8TFO4ACgkQ8Mjk52CukIwAIgCeJ/D8sh+LrdoNJmO3c08rqQJD
JHcAn3yP2gOOo0ljgeOvdx8Q5hGNjtwa
=xVXp
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F1314EE.6010404>
