[DAS] mysql.sock trouble

Imre Vastrik vastrik@ebi.ac.uk
Mon, 20 May 2002 09:01:20 +0100


Steve Chervitz wrote:
>  
> My /tmp/mysql.sock was apparently defunct, probably from an old mysql install
> that I did over a year ago. The real socket from the latest mysql installation
> was at /var/lib/mysql/mysql.sock and wasn't been recognized. I tried deleting
> /tmp/mysql.sock and re-installing LDasServer, but still no go.
> 
> Problem was solved by restarting mysqld with --socket=/tmp/mysql.sock
> 
> This however created another annoyance in that the mysqladmin now requires that
> I specify the --socket, since it defaults to /var/lib/mysql/mysql.sock.

You could also set up an environmental variable called MYSQL_UNIX_PORT
pointing to the socket (in sh: export
MYSQL_UNIX_PORT=/tmp/my_own_mysqld.sock). If this variable is set when
starting up the daemon or client the socket it points to is going to be
used.

Another way around the situation is not to use 'localhost' as the host
when setting up the connection (either with mysql client or
programmatically via DBI) but to use the "full name" of the machine the
server is running on. This is because (if I remeber correctly) the unix
socket is used only if the host is "localhost", otherwise tcp/ip
connection to specified port (usually 3306) is used (even if the address
specified is really the same box you work on).

Rgds.,

i