Can't connect to local MySQL server through socket '/tmp/mysql.sock

Steve Bertrand steve at ibctech.ca
Fri Jul 11 13:54:19 UTC 2008


Òàðàñ wrote:
> Hi! I need two MySQL servers run simultaneously. But when I try to run server I have
> 
>  ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Does this happen when you try to start the first instance, or starting 
the second instance when you already have one started.

If the latter is the case, you are going to have to tell the second 
instance to use a different socket file.

# touch /tmp/mysql.sock2
# chmod mysql_user:mysql_group /tmp/mysql.sock2

....and then, I believe if you add this to your /etc/my.cnf file:

[mysqld]
socket=/tmp/mysql.sock2

This should start at least one of your instances on the new socket, 
leaving the other one alone.

Note: I have not tested the above, its off the top of my head. Be worth 
Googling for verification.

Steve


More information about the freebsd-questions mailing list