I get this error. I am running drush on my local mac with MAMP installed. I was able to download a module just fine. I am running the command

drush en views_slideshow

and getting

Command pm-enable needs a higher bootstrap level to run - you will
need invoke drush from a more functional Drupal environment to run
this command.

Then it gives a hint suggesting the database may not be configured. But the spits out info that is correct for the database. Anything else that could cause this? I'm running the command from within the sites directory.

Comments

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)

Please read and follow the issue submission guidelines that you see when creating an issue

Also try to connect to mysql from the command line without using drush.

bkosborne’s picture

I apologize, grazed right over it.

Bootstrap to phase 0. [0.03 sec, 1.25 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.03 sec, 1.38 MB] [bootstrap]
Bootstrap to phase 6. [0.07 sec, 3.12 MB]                           [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.07 sec,   [bootstrap]
3.13 MB]
Initialized Drupal 6.20 root directory at                              [notice]
/Users/bosborne/git/newpa/httpdocs [0.09 sec, 3.64 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.09 sec,   [bootstrap]
3.64 MB]
Initialized Drupal site default at sites/default [0.09 sec, 3.64 MB]   [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration()     [bootstrap]
[0.09 sec, 3.64 MB]
Can't connect to local MySQL server through socket                  [bootstrap]
'/var/mysql/mysql.sock' (2) [0.1 sec, 3.67 MB]
Bootstrap to phase 5. [0.1 sec, 3.67 MB]                            [bootstrap]
Bootstrap to phase 6. [0.1 sec, 3.67 MB]                            [bootstrap]
Command pm-enable needs a higher bootstrap level to run - you will  [error]
need invoke drush from a more functional Drupal environment to run
this command. [0.1 sec, 3.67 MB]
The drush command 'en views_customfield' could not be executed. [0.1[error]
sec, 3.67 MB]
Drush was not able to start (bootstrap) the Drupal database.        [error]
Hint: This error often occurs when Drush is trying to bootstrap a
site that has not been installed or does not have a configured
database.

Drush was attempting to connect to : 
  Drupal version    : 6.20
  Site URI          : http://default
  Database driver   : mysqli
  Database hostname : localhost
  Database username : REMOVED
  Database name     : REMOVED
  Default theme     : garland
  Administration theme: garland
  PHP configuration : 
  Drush version     : 4.0-rc9
  Drush configuration: 
  Drush alias files : 
  Drupal root       : /Users/bosborne/git/newpa/httpdocs
  Site path         : sites/default
  Modules path      : sites/all/modules
  Themes path       : sites/all/themes
  %paths            : Array

You can select another site with a working database setup by
specifying the URI to use with the --uri parameter on the command
line or $options['uri'] in your drushrc.php file.
 [0.1 sec, 3.67 MB]

I am indeed able to login to mysql CLI with those credentials. However, MySQL is located in /Applications/MAMP/Library/bin. It looks like drush is looking for mysql.sock in /var/mysql. Could that be a problem? Also, MySQL was running on port 8889; I changed it to 3306 (I believe this to be the standard port), but that did not work either.

jonhattan’s picture

Change localhost to 127.0.0.1 in settings.php to see if it works. Also see #1011932: Support unix_socket in D7 $databases var in settings.php

bkosborne’s picture

Hmm, didn't help much. Tried some of those suggestions. Tried 127.0.0.1 with the same results..

bisonbleu’s picture

Had the same problem with "drush en". Making bin/php5.2/bin/php executable solves the problem!

I can now enable modules on my MAMP installation (OS X 10.5/MAMP Version 1.9).
Reference: http://drupal.org/node/222611#comment-3454468

Jukebox’s picture

#3 worked for me. That was a very strange problem.

Just to reiterate for anyone else who has this problem with MAMP 2.0.1, drush 7.x-4.5 and drupal 6.22:

1. In preferences, change the PHP version to 5.2.17
2. In settings.php, change 'localhost' to 127.0.0.1 in the mysql connection string.

mheinke’s picture

im having this same problem on RHEL 5.5, MYSQL: 5.5.15 Apache 2.2.3 and PHP 5.3.8

alberto56’s picture

subscribing. Same problem.

- in settings, changing localhost to 127.0.0.1 makes my site unusable.

Here is what I see.

local test6: drush pml
Command pm-list needs a higher bootstrap level to run - you will need invoke drush from a more functional Drupal environment to run this command.                                                                                                                  [error]
The drush command 'pml' could not be executed.                                                                                                                                                                                                                     [error]
Drush was not able to start (bootstrap) the Drupal database.                                                                                                                                                                                                       [error]
Hint: This error often occurs when Drush is trying to bootstrap a site that has not been installed or does not have a configured database.

Drush was attempting to connect to : 
  Drupal version    : 6.23-dev
  Site URI          : http://default
  Database driver   : mysqli
  Database hostname : localhost
  Database username : root
  Database name     : 20800test6
  Default theme     : garland
  Administration theme: garland
  PHP configuration : 
  Drush version     : 5.0-dev
  Drush configuration: 
  Drush alias files : 
  Drupal root       : /Applications/MAMP/htdocs/test6
  Site path         : sites/default
  Modules path      : sites/all/modules
  Themes path       : sites/all/themes
  %paths            : Array

You can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line or $options['uri'] in your drushrc.php file.

local test6: drush sqlc
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 1300
Server version: 5.5.9 Source distribution

Copyright (c) 2000, 2010, 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> show tables;
+-------------------------+
| Tables_in_20800test6    |
+-------------------------+
| access                  |
| actions                 |
| actions_aid             |
| authmap                 |
| batch                   |
| blocks                  |
| blocks_roles            |
[...]
mototribe’s picture

I had to change localhost to 127.0.0.1 and add port 8889. I'm on D7.8 using MAMP and drush 4.5

varr’s picture

Changing localhost to 127.0.0.1 worked for me (MAMP 2.0.3, PHP 5.3.6, Drush 4.5).

alberto56’s picture

Title: Command pm-enable needs a higher bootstrap level to run » Command pm-enable needs a higher bootstrap level to run on MAMP

This issue can occur when using MAMP and upgrading to Mac OS: the symlink to mysql socket might be lost on upgrades.

Kjartan’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

#437642: support for different MYSQL socket added support for unix_socket, so if you have it setup correctly in your sites settings.php it should work properly.

The actual issue here is a misconfiguration in mysql and/or php, usually as a result of the website using one php config while php-cli uses another. If you modify settings.php and add a unix_socket to the database configuration you can force Drupal and Drush to use the same socket.

dineshw’s picture

In settings.php make sure you using IP 127.0.0.1 instead of localhost

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'dbname',
      'username' => 'root',
      'password' => '',
      'host' => '127.0.0.1',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

Also make sure, while wirintg aliase file use 'db-url' and 'database' host will have IP 127.0.0.1 instead of localhost

$aliases['sitename'] = array(
    'uri' => 'http://siteurl:port/',
    'root' => '/path/to/remote/drupal/root',
    'db-url' => 'mysql://username:@127.0.0.1:3306/dbname',
    'databases' =>
      array (
        'default' =>
        array (
          'default' =>
          array (
            'driver' => 'mysql',
            'username' => 'root',
            'password' => '',
            'port' => '',
            'host' => '127.0.0.1',
            'database' => 'dbname',
          ),
       ),
     ),
  );
dineshw’s picture

Issue summary: View changes
Status: Closed (duplicate) » Needs review
helmo’s picture

Status: Needs review » Closed (won't fix)

[Stock response from Dreditor templates and macros.]

This issue was marked closed (won't fix) because Drush has moved to Github.
If this feature is still desired, you may copy it to our Github project. For best results, create a Pull Request that has been updated for the master branch. Post a link here to the PR, and please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.

jokavina’s picture

This work for me.
start your database server (mysql in most cases, or other depend on your configuration).
edit localhost to 127.0.0.1 in settings.php file
run the drush command again.

robbdavis’s picture

OK I found a different solution that worked for me.

Basically you have to add this line to .bash_profile: export PATH=/Applications/MAMP/Library/bin/:$PATH

I found it here http://log.itto.be/?p=1127

" Drush: “Command pm-enable needs a higher bootstrap level to run”

When running drush you can run into this error message. In my case, the mysql command line tool provided with Mamp Pro was not available. You can easily test this by typing the command ‘mysql’ in terminal. Your output might be -bash: mysql: command not found.

To solve this, do the following in terminal:
sudo vim ~/.bash_profile
Press i
Move to the last line and append
export PATH=/Applications/MAMP/Library/bin/:$PATH
Hit escape
Type in :wq (including the colon) to write the file and quit vim.
Reload your profile by running source ~/.bash_profile.

The mysql command AND drush should now work!"

lkcampbell’s picture

robbdavis, you rock! I've had this problem for a month and you found the solution!

Never even occurred to me to test the 'mysql' command.

My problem is actually with XAMPP, so I had to add:

export PATH=/Applications/XAMPP/bin/:$PATH

to my .bash_profile. But basically the same solution with a different path.

Anonymous’s picture

#17 worked for me. Thanks! :)

rooby’s picture

The problem line in the error output you had is this:

PHP configuration :

It is not detecting a configuration file.

When osx ships it has a default ini file but not a live one.

If you run on the command line: php --ini it will tell you where it is looking for the configuration file.
It is likely /etc

So you should be able to run:

sudo cp /etc/php.ini.default /etc/php.ini

Then command line php will start using /etc/php.ini as your configuration file.
Then you can edit that file and set it up as you wish.

I find it is generally best to use a different config for command line PHP and web/apache php because I usually want to set memory limit and such higher for the command line.

letsbuild’s picture

#9 fixed it for me.

Add replace localhost with 127.0.0.1 and add 8889 as the port.
note: just adding 127.0.0.1 alone breaks the site so make sure to add the port number too.

rockts’s picture

 drush pmi transliteration
Command pm-info needs a higher bootstrap level to run - you will need to invoke drush from a more functional  [error]
Drupal environment to run this command.
The drush command 'pmi transliteration' could not be executed.                                                [error]
A Drupal installation directory could not be found             

I used dursh management drupal out these problems, which can stick me look great God. Thank you!

protools’s picture

1) try run mysql from command line:
$ mysql
If not found error, create symbol link to bash:
$ sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/bin/mysql

try drush en

2) If not working and in setting.php you using unix socket like:

'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',

try create symbol link to unix socket:

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

ore

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

work for me on OS X yosemite + MAMP 3

Anonymous’s picture

After following tutorial from docs.drush.org I could eventually download a module.

The next hurdle was enabling the module.

Protools' answer missed a crucial bit of info for a beginner like me:
where to put in settings.php:
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',

This was eventually resolved for me by using the advice from JoelLarson, reply #6 on www.forumsarchive.laravel.io, which echoes protools suggestion.

I can now enable modules using drush

Wahoo

Happy days, until the next hurdle!!

strangerism’s picture

Had the same problem, I could download modules with rush but not enable them.
I have resolved it by just doing the same as Backlash did in post #24

added line

'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',

in settings.php

for instance

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'mysitedev',
      'username' => 'mysitedev',
      'password' => 'mysitedev',
      'host' => 'localhost',
      'unix_socket'   => '/Applications/MAMP/tmp/mysql/mysql.sock',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

cheers

kylebehse’s picture

#17 robbdavis is the best solution, as you can continue to use 'localhost' in your settings.php. I'm using MAMP Pro and just wanted to add a few PATH's to his example:

# SO DRUSH CAN EXICUTE EN COMMANDS IN TERMINAL
export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php/php5.5.18/bin:/Applications/MAMP/bin/php/php5.6.2/bin:/Applications/MAMP/bin/php/php5.4.34/bin:/Applications/MAMP/bin/php/php5.3.29/bin:/Applications/MAMP/bin/php/php5.2.17/bin:$PATH

Note: It should be all one line. And the # is something I added so I know what that line is when I am reading the file next time.

bsergiu’s picture

I have exactly the same issue I'm using AMPPS i can install the modules but when i want to activate them i get:

Command pm-enable needs a higher bootstrap level to run - you will need to invoke [error]
drush from a more functional Drupal environment to run this command.
The drush command 'en commerce commerce_ui' 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.

I've tried all the suggestion on the site but i just couldn't get it to work.

Joram’s picture

For anyone working with xampp on Windows, make sure that PATH in your environmental variables contains the following: "c:\xampp\mysql\bin;". Adjust the path to the location of xampp on your computer.

You will need to restart your terminal window before the command ('drush pm-enable' or 'drush en') will work. There is no need to modify 'localhost' to '127.0.0.1' and changing the port.

GiorgosK’s picture

run into this when setting up plesk with multiple php versions
when running drush en MODULENAME
I received following error

needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.

when running drush status
you get

...
 PHP executable         :  /usr/bin/php                                 
 PHP configuration      :  /etc/php.ini 
 PHP OS                 :  Linux                                        
 Drush script           :  /usr/local/src/drush/drush.php               
 Drush version          :  7.0.0-rc2   
...

the solution that worked for me is to login as ROOT and CHANGE DRUSH PHP VERSION to resolve mysql not connecting

HERE IS THE STEPS

- edited global variables
nano /etc/profile.d/bash_completion.sh

- inserted this at the end of file

...
export DRUSH_PHP=/opt/plesk/php/5.6/bin/php

- restart of the machine or source and relogin

source /etc/profile.d/bash_completion.sh
exit
ssh user@IP

after this change drush status
shows

...
 PHP executable                  :  /opt/plesk/php/5.6/bin/php                   
 PHP configuration               :  /opt/plesk/php/5.6/etc/php.ini    
...

Perhaps this solutions would work but have not tried
https://www.drupal.org/node/1302418

manuel.adan’s picture

It's likely php CLI can't to connect mysql. Type:

php -m

and check if pdo_mysql is in the list. If not, add to your php.ini file:

extension=php_pdo_mysql.so

Peter Majmesku’s picture

For me worked the following in .bash_profile on MAMP 3 and Mac Yosemite

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

Afterwards type

source ~/.bash_profile

and enter. ;)

jeffglenn’s picture

#31 worked for me. Thanks.

This is what I have in my .bash_profile:

PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
export PATH="/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH"
export PATH=/Applications/MAMP/Library/bin/:$PATH
export PATH=$HOME/.composer/vendor/bin:$PATH

Could someone let me know if some of that is redundant, please? I'm not very familiar with this just yet and don't quite understand it.

DieWaldfee’s picture

#32 your snipped worked for me ! thx

zonesny’s picture

Likewise, I'm running MAMP Pro 3 on Yosemite Mac, and I had to make TWO of the aforementioned changes to get it working correctly:

//fixes "Command pm-disable needs a higher bootstrap level to run" error
change .bash_profile (as per #17 and #31)

To solve this, do the following in terminal:
sudo vim ~/.bash_profile
Press i
Move to the last line and append
export PATH=/Applications/MAMP/Library/bin/:$PATH
Hit escape
Type in :wq (including the colon) to write the file and quit vim.
Reload your profile by running source ~/.bash_profile.

** AND **

//fixes "PDOException: SQLSTATE[HY000] [2002] No such file or directory" error; due to issue noted here
Add 'unix_socket' to settings.php file (as #23-25)

$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'mysitedev',
'username' => 'mysitedev',
'password' => 'mysitedev',
'host' => 'localhost',
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);

cswan’s picture

#9 worked for me. Thank you so much!

steffmomo’s picture

Number #31 worked for me. Thank you!

Peter Majmesku’s picture

It makes me happy that I could help you with #31. :)

oziris’s picture

So, after very long fight, this is how I fixed these issue:
1) Check if your drush is using the proper version of PHP. You can set it by "export DRUSH_PHP=/Applications/..." in your .bashrc file
2) Check if "mysql" command is rocognized by drush. Try "drush --debug status". If this is the problem, add "export PATH="/Applications/..../myslq_install_dir/:$PATH" to your .bashrc
3) The most IMPORTANT for me was ... DOWNGRADE to drush 6.* !! 7+ was not working for me! (for Drupal 7.x project)

Hope this helps.

FNGR’s picture

Great, #31 works!

aerozeppelin’s picture

I am using Ubuntu 14.04, #31 worked for me. Thank you!

ousaid.imtiaz’s picture

no.28 worked for me. Thanks

gambithi’s picture

My databases are on another server. I just install mysql on the same server and it started to work fine.

acnimda’s picture

Hope you can help me guys.

I run drush site-install standard --account-name=admin --account-pass=demo --db=url=mysql://test:demo1234@localhost/testdatabasedrupal_tutorial
I get answer:

A Drupal installation directory could not be found [error]
The command 'drush.php site-install standard' could not be found. [error]

How to solve this properly?

thanks in advance

acnimda’s picture

Hope guys hope you can help me,

I downloaded drupal into folder testdatabasedrupal_tutorial

I run testdatabasedrupal_tutorial l$ls

autoload.php   example.gitignore  profiles    themes
composer.json  index.php          README.txt  update.php
composer.lock  LICENSE.txt        robots.txt  vendor
core           modules            sites       web.config

SO I run testdatabasedrupal_tutorial$ drush site-install standard --account-name=admin --account-pass=demo --db=url=mysql://test:demo1234@localhost/testdatabasedrupal_tutorial
I get answer:

A Drupal installation directory could not be found [error]
The command 'drush.php site-install standard' could not be found. [error]

What am I missing and how to solve this properly?

thanks in advance

eigentor’s picture

Thank you Sirs and Madams, you saved my life! Finally I can really use Drush 8 on Windows.
The Tip of writing the path to mysql to .bashrc worked for me.
I am using Cygwin, and as a webserver I am using Xampp.
here is what I put into the .bashrc file in cygwin:
export PATH='/cygdrive/f/xampp/mysql/bin/:$PATH'
Xampp lives in F:/Xampp. People who use it will recognize the typical masking of Windows drives with /cygdrive.
That is where the mysql executable of Xampp lives.
Now I can install and uninstall modules and have a much easier life exporting config.

--- Edit ---------

For some weird reason, on another machine it did not work. After some investigating, I found out that the abovementioned line in Cygwin in .bashrc messed heavily with Cygwin. Nothing was working anymore, so I got a message by drush "wget nor curl executables found". Typing "wget" or anything else that I know was installed returned "Command not found".
Interestingly, the fix was as follows:
I used
export PATH=/cygdrive/f/xampp/mysql/bin/:$PATH
Note: there are no single quotes, no quotes at all around the path. What also worked was double quotes.
So, if in doubt: Try double quotes, single quotes, or no quotes at all.

Geographics’s picture

Ref: " Drush: “Command pm-enable needs a higher bootstrap level to run”

#17 worked for me

NOTE: I also had to run: sudo drush ...

yog_kulkarni’s picture

Thank you, robbdavis! Your solution worked for me.

Eranga’s picture

I faced the same problem in WAMP and I found out that the issue was mysql command was not working. Adding the mysql path to variables like said in #17 fixed the error. Thanks robbdavis.

gaurishankar’s picture

For XAMPP and Windows this is working for me "Make sure that PATH in your environmental variables contains the following: "c:\xampp\mysql\bin;". Adjust the path to the location of xampp on your computer".

#28 working for me.

Thanks!

Anonymous’s picture

add in setting.php you using unix socket like:

'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',

$databases['default']['default'] = array(
  'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',

  'database' => 'drupal8',
  'username' => 'root',
  'password' => 'root',
  'prefix' => '',
  'host' => '127.0.0.1',
  'port' => '8889',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);
easwari’s picture

I am on Solaris 11 and number #28 worked for me.

Thank you!

ericdaal’s picture

Estoy en Windows 7 con Wamp y el número 28 trabajó para mí.

Saludos.

aaronsssp’s picture

It's a MySQL Problem.

On your terminal write:
mysql
if you see: Unknown command 'mysql'

Then write:
drush cex --debug

If you see something like that:

Executing: mysql --defaults-extra-file=/private/tmp/drush_yCOXu6 --database=cogeco_dev --socket=/var/mysql/mysql.sock --port=8889 --silent  < /private/tmp/drush_wfnG9m
  sh: mysql: command not found

Then you have to install mysql
On Mac OS install Brew: https://brew.sh

Brew install mysql

Your problem will be solved after that

avinash_thombre’s picture

I was not able to enable module even though I download it using drush. The error was "Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more functional [error]
Drupal environment to run this command.
The drush command 'en token' 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."

The solution is simple, just add the following path to your system variables. "C:\xampp\mysql\bin". Moreover, make sure following paths are added to the system variables: C:\Users\Admin\AppData\Roaming\Composer\vendor\bin;
C:\Users\Admin\AppData\Roaming\Composer\vendor\drush\drush\;
C:\Program Files\Git\cmd;C:\ProgramData\ComposerSetup\bin;
C:\xampp\mysql\bin;
C:\xampp\php;

This will take out the error of not able to enable modules despite downloading. Worked for me.

Dillibabu’s picture

Check with your project folder. if you are in correct place. then try "drush en module-name -y". It will resolve your problem.

bajah1701’s picture

I had this similar issue with drush en kint. After trying many of the solutions on here with no success, I took a break. When I returned to working on my project I realized that I may have been in the wrong folder. Once I change prompt in the command line to the right folder it worked.

senortim’s picture

Thumbs up for #34. Drush wanted to use my /usr/bin/php on my clean install of macOS Mojave and MAMP Pro 5.

robjob118’s picture

I'm using Windows 10 with xampp and #28 worked for me.
Adding C:\path\to\mysql\bin to the list of path's in the Environmental Variables menu of System Properties.
Thanks Joram

abhi shetty’s picture

#24 solved the issue for me.
Thanks strangerism

LCdev’s picture

#28 it worked for me

sowndharya’s picture

Version: All-versions-4.0-rc8 » 8.x-6.x-dev

Tired #28 added Environment variable also still not working

Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more [error]functional Drupal environment to run this command.
The drush command 'en serialization' could not be executed.

n4r3n’s picture

I was getting similar error when I run drush en acquia_connector
Error: Command pm-enable needs a higher bootstrap level to run.

Upgrading drush version from 8.1.17 to 10.3.5 (latest) solved my issue.

Coop920’s picture

#28 did it for me. Make sure to restart the terminal!

valery akimov’s picture

I’ve been using drush 8.* and Drupal 7 on a local Denver-3 server (Apache 2.2.22, PHP 5.6.8, MySQL 5.5.25), OS Windows 7 (Windows 10) for many years, and recently also on local server XAMPP 7.2.34, PHP 7.2.34, MariaDB 10.4.14, OS Linux Mint 20.
But not so long ago I started to encounter an error when using the “up” command:

$ drush @blog.loc up views

Command pm-update 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 'up views' could not be executed. [error]

Aliases:

//Site for development
$aliases['loc'] = array(
//Path to site folder
  'root' => '/home/nic/www/blog.loc1',
//Site domain
  'uri' => 'blog.loc1',
// User for ssh connection
  'remote-user' => 'root',
  'ssh-options' => '-T',
//DB parameters
  'db-url' => 'mysql://root:@localhost/db_name',
  'path-aliases' => array(
//Path to folder with files
    '%files' => '/home/nic/www/blog.loc1/sites/default/files',
  ),
);

When using the “up” command without aliases in the root directory of Drupal another error occurs:

$ cd ~/www/blog.loc1
$ drush up views

pm-updatestatus failed. [error]

I’ve found out by experiment that these errors do not occur if I comment the following line in aliases:
//'db-url' => 'mysql://root:@localhost/db_name',

Then the up command can be run successfully from any directory using the aliases and also from the root directory of Drupal. I couldn’t find the reason why this happens.
The problem mentioned above is also relevant for Denver Server for Windows 10 – see https://blog.orel-hor.ru/oshibki-komandy