2

This question already has an answer here:

I use MAMP on Mac.

When I try to use drush en omega command on drupal root directory to install omega, But the terminal throw me an error:

drupal-7.23 tangmonk $ drush en omega

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 omega' 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.

Drush was attempting to connect to:
 Drupal version         :  7.23
 Site URI               :  http://default
 Database driver        :  mysql
 Database username      :  root
 Database name          :  drupal
 Default theme          :  garland
 Administration theme   :  garland
 PHP executable         :  /usr/bin/php
 PHP configuration      :
 PHP OS                 :  Darwin
 Drush version          :  7.0-dev
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Users/tangmonk/Sites/drupal/drupal-7.23
 Site path              :  sites/default
 File directory path    :  sites/default/files
     * 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.

It seems mysql issue. But my site run perfect.

marked as duplicate by kenorb, Shawn Conn, Adrian Cid Almaguer, No Sssweat, googletorp Mar 25 '16 at 10:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Either you're not running this in the web root, or the user you're running Drush with doesn't have read permissions on sites/[SITE]/settings.php – Clive Jan 3 '14 at 9:58
  • Are you sure you're currently in a Drupal directory? – Ambidex Jan 3 '14 at 10:01
  • @Ambidex, Thanks for your reply, Yes, I am run in a drupal directory. – TangMonk Jan 3 '14 at 10:02
  • Are you sure you're running the command from /Users/tangmonk/Sites/drupal/drupal-7.23 and not /Users/tangmonk/Sites/drupal? – Clive Jan 3 '14 at 10:09
  • @Clive, Yes, I am very sure. – TangMonk Jan 3 '14 at 10:10
4

I run drush command as MAMP Integrated PHP, It works!

I add alias command to my shell:

$ vim ~/.bash_profile
alias drush='/Applications/MAMP/bin/php/php5.5.3/bin/php /opt/drush/drush.php'
  • This worked for me, but note that your drush.php could be in a different location than indicated above. For example, mine is located at: ~/pear/share/pear/drush/drush.ph – David M Jan 26 '15 at 3:03
3

This is what worked for me

sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock

Changing to 127.0.0.1 in settings.php worked for quite a few too, but not for me.

Infact I had to make sure, it was localhost.

  • Thanks for your reply, I've found a better way: run drush as MAMP Integrated PHP – TangMonk Jan 22 '14 at 13:10
1

I HAD the same problem. I think there may be different causes but in mycase I run

drush status -d

and got

Bootstrap to phase 0. [0 sec, 1.88 MB]                               [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 2.01 MB] [bootstrap]
Cache MISS cid: 6.5.0-alias-path--895a900da5a848eb4b6977657b24c58f       [debug]
[0.01 sec, 2.01 MB]
Cache HIT cid: 6.5.0-commandfiles-0-82a4097a58b8537b29e63894fab2597c     [debug]
[0.01 sec, 2.03 MB]
Bootstrap to phase 0. [0.08 sec, 5.38 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.13 sec,    [bootstrap]
6.22 MB]
Initialized Drupal 7.34 root directory at                               [notice]
/opt/lampp/htdocs/fish-nn.dev [0.14 sec, 6.22 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.14 sec,    [bootstrap]
6.23 MB]
Initialized Drupal site default at sites/default [0.14 sec, 6.23 MB]    [notice]
Cache HIT cid: 6.5.0-commandfiles-2-062e26fa8ebdd8c444d688ab9447c986     [debug]
[0.14 sec, 6.24 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.14[bootstrap]
sec, 6.24 MB]
mysql extension for PHP PDO is not installed. Check your php.ini to  [bootstrap]
see how you can enable it. Proceeding with the mysql PDO extension.
[0.15 sec, 6.25 MB]
could not find driver [0.15 sec, 6.26 MB]                            [bootstrap]
Found command: core-status (commandfile=core) [0.15 sec, 6.25 MB]    [bootstrap]
Loading outputformat engine. [0.22 sec, 6.28 MB]                        [notice]
Calling hook drush_core_status [0.22 sec, 6.33 MB]                       [debug]
Returned from hook drush_core_status [0.22 sec, 6.34 MB]                 [debug]
 Drupal version         :  7.34                          
 Site URI               :  http://default                
 Database driver        :  mysql                         
 Database username      :  root                          
 Database name          :  fishnn                        
 Default theme          :  garland                       
 Administration theme   :  garland                       
 PHP executable         :  /usr/bin/php                  
 PHP configuration      :  /etc/php.ini                  
 PHP OS                 :  Linux                         
 Drush version          :  6.5.0                         
 Drush configuration    :                                
 Drush alias files      :                                
 Drupal root            :  /opt/lampp/htdocs/fish-nn.dev 
 Site path              :  sites/default                 
 File directory path    :  sites/default/files         

through all these lines I was interested by

mysql extension for PHP PDO is not installed. Check your php.ini to  [bootstrap]
see how you can enable it. Proceeding with the mysql PDO extension.
[0.15 sec, 6.25 MB]
could not find driver [0.15 sec, 6.26 MB]                            [bootstrap]

so I run

yum install php-pdo php-mysqli

And got the profit

  • Hi and welcome to Drupal Answers. I believe your answer is not applicable to the question's issue. – Wtower Mar 1 '15 at 8:30
1

I solved this by adding this to my .bash_profile

export PATH=$PATH:/Applications/MAMP/Library/bin

See: http://www.webbykat.com/2012/06/solving-sh-mysql-command-not-found-mamp-pro-2

Before after running drush status -d I had:

sh: mysql: command not found.

0

If you've already tried various methods for installing drush without success, such as Composer, Brew, etc., you may have collected some conflicting settings. Check your ~/.drush directory and bash profile files for files and settings left over from prior attempts.

0

I'm running Windows/Git Bash. For me, the issue was that mysql wasn't in the PATH. St.Cremer's suggestion was actually helpful.

Running

drush status -d

got me a different error showing me that mysql wasn't recognized as an internal command. So, if you haven't found a solution yet, chances are that this command might lead you to a solution like it did me.

0

I needed to add this to my ~/.profile file:

alias mysql='/Applications/MAMP/Library/bin/mysql'

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