Saturday, June 06, 2009

transient error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

While experimenting with an Amazon OpenSolaris+GlassFish+MySQL AMI. I have been getting some weird errors when launching mysql. 

-bash-3.2$ mysql -u root -p

Enter password: 

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)


I don't know if it has to do with this particular image (install/config issue) or if it's a side effect of the fact that's run on a virtual server, but a quick workaround seems to be:

svcadm restart mysql ran as root 

No comments: