Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedPlease 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.
Comment #2
bkosborneI apologize, grazed right over it.
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.
Comment #3
jonhattanChange 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
Comment #4
bkosborneHmm, didn't help much. Tried some of those suggestions. Tried 127.0.0.1 with the same results..
Comment #5
bisonbleu CreditAttribution: bisonbleu commentedHad 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
Comment #6
Jukebox CreditAttribution: Jukebox commented#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.
Comment #7
mheinke CreditAttribution: mheinke commentedim having this same problem on RHEL 5.5, MYSQL: 5.5.15 Apache 2.2.3 and PHP 5.3.8
Comment #8
alberto56 CreditAttribution: alberto56 commentedsubscribing. Same problem.
- in settings, changing localhost to 127.0.0.1 makes my site unusable.
Here is what I see.
Comment #9
mototribe CreditAttribution: mototribe commentedI had to change localhost to 127.0.0.1 and add port 8889. I'm on D7.8 using MAMP and drush 4.5
Comment #10
varr CreditAttribution: varr commentedChanging localhost to 127.0.0.1 worked for me (MAMP 2.0.3, PHP 5.3.6, Drush 4.5).
Comment #11
alberto56 CreditAttribution: alberto56 commentedThis issue can occur when using MAMP and upgrading to Mac OS: the symlink to mysql socket might be lost on upgrades.
Comment #12
Kjartan CreditAttribution: Kjartan commented#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.
Comment #13
dineshw CreditAttribution: dineshw commentedIn settings.php make sure you using IP 127.0.0.1 instead of localhost
Also make sure, while wirintg aliase file use 'db-url' and 'database' host will have IP 127.0.0.1 instead of localhost
Comment #14
dineshw CreditAttribution: dineshw commentedComment #15
helmo CreditAttribution: helmo commented[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.
Comment #16
jokavina CreditAttribution: jokavina commentedThis 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.
Comment #17
robbdavis CreditAttribution: robbdavis commentedOK 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!"
Comment #18
lkcampbell CreditAttribution: lkcampbell commentedrobbdavis, 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.
Comment #19
Anonymous (not verified) CreditAttribution: Anonymous commented#17 worked for me. Thanks! :)
Comment #20
rooby CreditAttribution: rooby commentedThe 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.
Comment #21
letsbuild CreditAttribution: letsbuild commented#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.
Comment #22
rockts CreditAttribution: rockts commentedI used dursh management drupal out these problems, which can stick me look great God. Thank you!
Comment #23
protools CreditAttribution: protools commented1) 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
Comment #24
Anonymous (not verified) CreditAttribution: Anonymous commentedAfter 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!!
Comment #25
strangerism CreditAttribution: strangerism commentedHad 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
cheers
Comment #26
kylebehse CreditAttribution: kylebehse commented#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.
Comment #27
bsergiu CreditAttribution: bsergiu commentedI 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.
Comment #28
Joram CreditAttribution: Joram commentedFor 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.
Comment #29
GiorgosKrun into this when setting up plesk with multiple php versions
when running
drush en MODULENAME
I received following error
when running
drush status
you get
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
- restart of the machine or source and relogin
after this change
drush status
shows
Perhaps this solutions would work but have not tried
https://www.drupal.org/node/1302418
Comment #30
manuel.adanIt'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
Comment #31
Peter MajmeskuFor me worked the following in .bash_profile on MAMP 3 and Mac Yosemite
Afterwards type
and enter. ;)
Comment #32
jeffglenn CreditAttribution: jeffglenn commented#31 worked for me. Thanks.
This is what I have in my .bash_profile:
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.
Comment #33
DieWaldfee CreditAttribution: DieWaldfee commented#32 your snipped worked for me ! thx
Comment #34
zonesny CreditAttribution: zonesny commentedLikewise, 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)
** 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)
Comment #35
cswan CreditAttribution: cswan commented#9 worked for me. Thank you so much!
Comment #36
steffmomo CreditAttribution: steffmomo commentedNumber #31 worked for me. Thank you!
Comment #37
Peter MajmeskuIt makes me happy that I could help you with #31. :)
Comment #38
oziris CreditAttribution: oziris as a volunteer commentedSo, 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.
Comment #39
FNGR CreditAttribution: FNGR commentedGreat, #31 works!
Comment #40
aerozeppelin CreditAttribution: aerozeppelin commentedI am using Ubuntu 14.04, #31 worked for me. Thank you!
Comment #41
ousaid.imtiaz CreditAttribution: ousaid.imtiaz commentedno.28 worked for me. Thanks
Comment #42
gambithi CreditAttribution: gambithi commentedMy databases are on another server. I just install mysql on the same server and it started to work fine.
Comment #43
acnimda CreditAttribution: acnimda as a volunteer commentedHope 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:
How to solve this properly?
thanks in advance
Comment #44
acnimda CreditAttribution: acnimda as a volunteer commentedHope guys hope you can help me,
I downloaded drupal into folder testdatabasedrupal_tutorial
I run testdatabasedrupal_tutorial l$
ls
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:
What am I missing and how to solve this properly?
thanks in advance
Comment #45
eigentor CreditAttribution: eigentor commentedThank 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.
Comment #46
Geographics CreditAttribution: Geographics commentedRef: " Drush: “Command pm-enable needs a higher bootstrap level to run”
#17 worked for me
NOTE: I also had to run: sudo drush ...
Comment #47
yog_kulkarni CreditAttribution: yog_kulkarni commentedThank you, robbdavis! Your solution worked for me.
Comment #48
Eranga CreditAttribution: Eranga commentedI 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.
Comment #49
gaurishankarFor 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!
Comment #50
Anonymous (not verified) CreditAttribution: Anonymous commentedadd in setting.php you using unix socket like:
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
Comment #51
easwari CreditAttribution: easwari commentedI am on Solaris 11 and number #28 worked for me.
Thank you!
Comment #52
ericdaal CreditAttribution: ericdaal commentedEstoy en Windows 7 con Wamp y el número 28 trabajó para mí.
Saludos.
Comment #53
aaronsssp CreditAttribution: aaronsssp commentedIt'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:
Then you have to install mysql
On Mac OS install Brew: https://brew.sh
Brew install mysql
Your problem will be solved after that
Comment #54
avinash_thombre CreditAttribution: avinash_thombre as a volunteer and commentedI 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.
Comment #55
Dillibabu CreditAttribution: Dillibabu commentedCheck with your project folder. if you are in correct place. then try "drush en module-name -y". It will resolve your problem.
Comment #56
bajah1701 CreditAttribution: bajah1701 as a volunteer commentedI 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.
Comment #57
senortim CreditAttribution: senortim commentedThumbs up for #34. Drush wanted to use my /usr/bin/php on my clean install of macOS Mojave and MAMP Pro 5.
Comment #58
robjob118 CreditAttribution: robjob118 as a volunteer commentedI'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
Comment #59
abhi shetty CreditAttribution: abhi shetty commented#24 solved the issue for me.
Thanks strangerism
Comment #60
LCdev CreditAttribution: LCdev commented#28 it worked for me
Comment #61
sowndharya CreditAttribution: sowndharya commentedTired #28 added Environment variable also still not working
Comment #62
n4r3nI 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 from8.1.17
to10.3.5
(latest) solved my issue.Comment #63
Coop920 CreditAttribution: Coop920 commented#28 did it for me. Make sure to restart the terminal!
Comment #64
valery akimov CreditAttribution: valery akimov commentedI’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:
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