Had an odd problem working with new D7 sites on my Mac laptop. Turns out I needed to edit the settings.php file to use 127.0.0.1 instead of its default entry for localhost.
Referenced from: http://drupal.org/node/726970
Here's an example:
peterm-macbook:sites peterm$ drush dl views
SQLSTATE[HY000] [2002] No such file or directory [warning] Project views (7.x-3.0-alpha1) downloaded to [success] /library/webserver/documents/drupal-7.0/sites/all/modules/views.
PDO::__construct(): [2002] No such file or directory (trying to [warning] connect via unix:///var/mysql/mysql.sock) in drush_valid_db_credentials() (line 952 of /opt/local/drush/includes/environment.inc).