2

I'm using Acquia DevDesktop application on Mac, I installed a new website on that , everything seems Ok but when I got to the installed path and try to update Drupal core with drush up faced with

➜  thunder-8.x-1.0-core drush up
Command pm-update needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal         [error]
environment to run this command.
The drush command 'up' could not be executed.                                                                                 [error]
Drush was not able to start (bootstrap) the Drupal database.                                                                  [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another
site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See `drush topic
docs-aliases` for details.
 * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed
shell. See http://drupal.org/node/1428638 for details.

Drush was attempting to connect to:
 Drupal version         :  8.2.5
 Site URI               :  http://default
 PHP executable         :  /usr/bin/php
 PHP configuration      :
 PHP OS                 :  Darwin
 Drush script           :  /Users/yms/.composer/vendor/drush/drush/drush.php
 Drush version          :  8.1.10
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Users/yms/Sites/devdesktop/thunder-8.x-1.0-core
 Drupal Settings File   :  sites/default/settings.php
 Site path              :  sites/default

In the issues reported I found about this problem, adding Mysql path to PATH resolve the problem, but in my case when I type mysql on command prompt it works correct and that means The mysql path is added to PATH. but I don't know why Drush couldn't find the database connection.

Also in my connection to db Acquia used 127.0.0.1 So changing localhost to 127.0.0.1 is not the solution

3 Answers 3

3

After wasting a few hours I resolve it with adding driver property to $databases in settings.php .

$databases['default']['default'] = array (
  'database' => 'XXX',
  'username' => 'XXXX',
  'password' => 'XXX',
  'prefix' => '',
  'host' => '127.0.0.1',
  'port' => '33067',
  'driver' => 'mysql',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', 
);

I hope this could save another guys time in future in the same problem.

2
  • 1
    If you end up here and DO have driver specified, you should also check the other things defined here. Drush will choke is 'localhost' is defined as the host in some cases. Try switching to an IP address. Oct 28, 2020 at 22:03
  • Thanks @WestonWedding, changing the host to IP did it for me.
    – Overcomer
    Jun 17, 2023 at 0:05
2

Using Acquia DevDesktop application on Mac OS, drush could not find database settings. My solution was to comment out <DDSETTINGS> and copy the connection details directly into settings.php :

// <DDSETTINGS>
// Please don't edit anything between <DDSETTINGS> tags.
// This section is autogenerated by Acquia Dev Desktop.
// if (isset($_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR']) && file_exists($_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] . '/loc_1sexshop2018_dd.inc')) {
//   require $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] . '/loc_mysite_dd.inc';
// }
// </DDSETTINGS>

// DDSettings
// Copied from $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] . '/loc_mysite_dd.inc' in order to work with drush
$databases['default']['default'] = array(
  'driver' => 'mysql',
  'database' => 'mydb',
  'username' => 'drupaluser',
  'password' => '',
  'host' => '127.0.0.1',
  'driver' => 'mysql',
  'port' => 33067 );

if (empty($config_directories['active']))
  $config_directories['active'] = "sites/default/files/config_...my_config.../active";
if (empty($config_directories['staging']))
  $config_directories['staging'] = "sites/default/files/config_...my_config.../staging";

if (empty($settings['hash_salt']))
    $settings['hash_salt'] = '...myhash...';
// /DDSettings
1

You will have to give root path and URI in your drush command

e.g

`drush --root=/path/to/drupal-installation --uri=youdomain.com <command>`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.