if drush cannot connect to the database and needs a higher bootstrap level to continue.

link to original post

"The only way to make it work is to add the unix_socket line to my Drupal settings.php files for all my projects:"

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'site',
      'username' => 'user',
      'password' => 'pass',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
      'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
    ),
  ),
);

this goes into the drush alias:

$aliases['hvdtest'] = array(
  'root' => '/Users/james_barnett/Sites/hvdcolladmis/docroot',
  'uri'  => 'http://hvdcolladmis:8888/',
  $databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'hvdcolladmis_test',
'username' => 'xxxx',
'password' => 'xxxx',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
),
),
),
);
and this goes into the settings.php
$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'hvdcolladmis_test',
      'username' => 'root',
      'password' => 'root',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
      'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
    ),
  ),
);