I've installed Drush 7 using Composer and working with Drupal 8 and 7 on Ubuntu 12.04 with PHP 5.4.31, mysql 5.5.38
dl modules and themes just fine but when I want to
en a module then it gives me the
Drush was not able to start (bootstrap) the Drupal database.
So upon further investigation I did this:
$ drush -v -d sql-cli Starting Drush preflight. [0.02 sec, 1.15 MB] [preflight] Cache HIT cid: [debug] 7.0-dev-commandfiles-0-87f720da39665f2c425de5e651f2ac4d [0.05 sec, 1.19 MB] Bootstrap to phase 0. [0.2 sec, 3.19 MB] [bootstrap] Bootstrap to phase 0. [0.28 sec, 3.19 MB] [bootstrap] Found command: sql-cli (commandfile=sql) [0.28 sec, 3.19 MB] [bootstrap] Calling hook drush_sql_cli [0.56 sec, 3.21 MB] [debug] Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.56 sec, [bootstrap] 3.22 MB] Initialized Drupal 8.0-dev root directory at [notice] /home/wavesailor/My_sites/bootstrap-business [0.62 sec, 3.52 MB] Cache HIT cid: [debug] 7.0-dev-commandfiles-1-67528d048330f8c38ed66ea20e647906 [0.62 sec, 3.52 MB] Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.63 sec, [bootstrap] 3.57 MB] Initialized Drupal site default at sites/default [0.63 sec, 3.57 MB] [notice] Cache MISS cid: [debug] 7.0-dev-install_profile-66ecfeb9791a023150773849f1550c5d [0.64 sec, 3.57 MB] Cache HIT cid: [debug] 7.0-dev-commandfiles-2-027a7d06ad1248d56c7499a21fb8d2df [0.65 sec, 3.57 MB] Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.65[bootstrap] sec, 3.57 MB] Calling proc_open(mysql --defaults-extra-file=/tmp/drush_ST3u9r --database=bootstrap_business --host=127.0.0.1 --port=3306); ERROR 1045 (28000): Access denied for user 'my_username'@'localhost' (using password: YES) Returned from hook drush_sql_cli [0.87 sec, 3.72 MB] [debug] Command dispatch complete [0.87 sec, 3.71 MB] [notice] Peak memory usage was 5.21 MB [0.87 sec, 3.7 MB] [memory] $
It seems it cannot connect to the database so I did the following:
$ drush sql-connect mysql --user=my_username --password=my_password --database=bootstrap_business --host=127.0.0.1 --port=3306 $ mysql --user=my_username --password=my_password --database=bootstrap_business --host=127.0.0.1 --port=3306 Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 286 Server version: 5.5.38-0ubuntu0.12.04.1 (Ubuntu) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
I can connect manually to the database with the connection string given by drush.
So then I deleted the
.drush folder in my home directory but that did not help.
I did try this for both Drupal 7 and 8 sites.
So then I downgraded to drush 6 (
composer global require drush/drush:6.*) and drush then worked flawlessly with Drupal 7 sites. I then upgraded to drush 7 (
composer global require drush/drush:dev-master) and it stops working again
Any ideas on how to solve this??