Search code examples
apachedrupalosx-elcapitandrush

My drush doen't run commands to database (apache)


I have set up Virtual Hosts in apache on my Mac(El Capitan). All my projects are located in my Users/MyName/Sites and I installed Drush. I am able to download stuf using drush like: drush dl drupal. But when I try to enable modules using drush I get the following:

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.
The drush command 'en admin_toolbar' 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        :  7.41                                      
Site URI              :  http://default                            
Database driver       :  mysql                                     
Database hostname     :  localhost                                 
Database port         :                                            
Database username     :  root                                      
Database name         :  MyDatabase                                 
PHP executable        :  /usr/bin/php                              
PHP configuration     :                                            
PHP OS                :  Darwin                                    
Drush script          :  /Users/kim/.composer/vendor/drush/drush/drush.php                                  
Drush version         :  8.1-dev                                   
Drush temp directory  :  /tmp                                                          
Drush configuration   :                                            
Drush alias files     :                                            
Drupal root           :  /Users/MyName/Sites/MyProject                          
Site path             :  sites/default

My gues is that my drush isn't configured correctly to my database settings but I don't know how to fix this or if this is the real issue. If anyone could help me, that would be great!


Solution

  • Fixed it myself, for apache the path in the .bash_profile is

    export PATH="/usr/local/mysql/bin:$PATH"