Lets start with saying that i am not familiar with Drush at all. But looking at this from a MAMP perspective i think i know what is going on here.
The line
PDO::__construct(): [2002] No such file or directory (trying to connect via [warning]
unix:///var/mysql/mysql.sock) environment.inc:523
says it all.
By default MAMP is creating the MySQL socket in /Applications/MAMP/tmp/mysql/mysql.sock
as stated on the MAMP launch page. However Drush is expecting the socket at var/mysql/mysql.sock
.
Well there are two ways to fix this.
Stop all MAMP servers. Edit the file
/Applications/MAMP/bin/startMysql.sh
, change--socket=/Applications/MAMP/tmp/mysql/mysql.sock
into--socket=/var/mysql/mysql.sock
. And don't forget to edit stopMysql.sh as well. This tells MAMP to store the socket elsewhere the next time it boots up the Mysql server.Create a symlink from
/var/mysql/mysql.sock
to/Applications/MAMP/tmp/mysql/mysql.sock
see this post for more info on symlinks. MAMP will need to be running for you to do this, as the socket file is created dynamically.
Good luck!