Ubuntu Error 2002 “Can't connect to local MySql server through socket…”

mysql.sock is NOT a socket file, it is a standard file with 0 byte size.

I'd (1) terminate mysql, (2) delete the mysql.sock file, and then (3)restart mysql which will properly make the socket file. You should see a socket file looking like the following when doing an ls -l mysql.sock.

 srwxrwxrwx 1 mysql mysql            0 2011-10-06 15:25 mysql.sock