WebTechKitchen; Your Web Technology Kitchen, contact us to create, or maintain your websites and other digital properties.

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

Submitted by barnettech on Tue, 06/12/2018 - 23:58

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',
    ),
  ),
);