I was trying to generate model code from cake command line tool. But got this issue.
Warning Error: PDO::__construct(): [2002] No such file or directory (try
With MAMP create a symbolic link in the folder /var/mysql/:
sudo ln -n /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock