Drush cannot connect to mysql I have a problem with Drush to enable or disable module. But downloading modules works perfect! However I want to use Drush in its full range.

Yesterday, I saw my Drush would not succeed in connecting to the database. I already tried to update the path in .bash_profile to the AMPPS path. But after that, my bash cannot find the database any more. I already deleted the line but bash don't find mysql.

Anybody has an idea about what to do to resolve this?

Below are the various messages I received:


  Sams-MacBook-Pro:demo Sam$ drush en views -d
  
  Starting Drush preflight. [0.01 sec, 1.82 MB]                        [preflight]
  
  Cache HIT cid:                                                         [debug]
  
  7.0-dev-commandfiles-0-9942ce60ec4ba1e3ca6f94d08d021773 [0.01 sec,
  1.88 MB] Bootstrap to phase 0. [0.09 sec, 5.75 MB]                   [bootstrap]
  
  Bootstrap to phase 6. [0.09 sec, 5.76 MB]                            [bootstrap]
  
  Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.09 sec,    [bootstrap]
  5.76 MB]
  
  Initialized Drupal 7.34 root directory at                              [notice]
  
  /Applications/AMPPS/www/demo [0.1 sec, 6.09 MB]
  
  Cache HIT cid:                                                         [debug]
  7.0-dev-commandfiles-1-68c4337f6c538cdf6d3ca715c4afb7a3 [0.1 sec,
  4.17 MB]
  
  Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.1 sec, 4.18[bootstrap] MB]
  
  Initialized Drupal site default at sites/default [0.1 sec, 4.18 MB]    [notice]
  
  Cache HIT cid:                                                         [debug]
  7.0-dev-commandfiles-2-9518eda12b48158193bd617384d95a7d [0.11 sec,
  4.18 MB]
  
  Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.11[bootstrap] sec, 4.18 MB]
  
  sql-query: SELECT 1; [0.11 sec, 4.3 MB]                              [status]
  
  Executing: mysql --defaults-extra-file=/private/tmp/drush_9NOj8N
  --database=demoDB --host=127.0.0.1 --silent  &lt; /private/tmp/drush_gIJn4w
  
  sh: mysql: command not found
  
  Bootstrap to phase 5. [0.12 sec, 4.3 MB]                             [bootstrap]
  
  Command pm-enable needs a higher bootstrap level to run - you will   [error]
  
  need to invoke drush from a more functional Drupal environment to run
  this command. [0.12 sec, 4.3 MB]
  
  The drush command 'en views' could not be executed. [0.12 sec, 4.3   [error] MB]
  
  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         :  7.34
  Site URI               :  http://default
  Database driver        :  mysql
  Database hostname      :  127.0.0.1
  Database port          :
  Database username      :  demoDB
  Database name          :  demoDB
  PHP executable         :  /usr/bin/php
  PHP configuration      :
  PHP OS                 :  Darwin
  Drush version          :  7.0-dev
  Drush temp directory   :  /tmp
  Drush configuration    :
  Drush alias files      :
  Drupal root            :  /Applications/AMPPS/www/demo
  Site path              :  sites/default
  
  [0.17 sec, 6.42 MB]   Sams-MacBook-Pro:demo Sam$
Ok i solved that problem my own. I have deleted the Drush Version 7.x and installed the 6.x Version. it works like a charm.