I installed MySQL on Mac OS X Mountain Lion with homebrew install mysql, but when I tried mysql -u root I got the following error:
homebrew install mysql
mysql -u root
In my case right after installing the MAMP accessing mysql from the terminal was giving the same socket error. At the end all it wanted was a restart and it's working.