16

Do you have any idea on what might be causing this error when I execute:

drush si geoslate --db-url='mysql://root:root@localhost/geoslate' --site-name=Geoslate

Command site-install needs a higher bootstrap level to run - you will need to invoke from a more functional Drupal environment to run this command.
The drush command 'si vimn_geoslate' could not be executed.
A Drupal installation directory could not be found

?

5 Answers 5

20

This particular error happens when drush cannot find the settings.php file to read in and "bootstrap" itself.

You need to cd into the drupal directory (Document root) of your drupal install in order for it to read in a settings.php file.

3
  • Further to this, you may need to use the -r option to specify the root in some setups. Commented Apr 11, 2013 at 11:59
  • 12
    I know this is an old question and answer, but can you elaborate on why a settings.php file is needed for a drush site-install command, which normally creates this file?
    – mpdonadio
    Commented Apr 18, 2016 at 23:58
  • Somewhat related to @mpdonadio's comment above, it was not immediately obvious to me that this drush site-install command doesn't actually download Drupal. You need to run something like drush dl drupal-7.x first, then run the Drush command from inside this newly-downloaded Drupal folder.
    – jeff-h
    Commented Nov 5, 2022 at 22:51
2

For that error: Drush needs a higher bootstrap level to run

Write on your terminal: mysql

if you see something that:

Unknown command 'mysql'

Then the problem comes from mysql, that's why your drush commands don't work.

Install MySql by Brew: https://brew.sh

Brew install mysql
1

When I wanted to install and enable some modules I encountered with this error. by changing the line 'host' => 'localhost' in settings.php file of my site to 'host' => php_sapi_name() == 'cli' ? '127.0.0.1' : 'localhost' now I can install my modules through Drush.

1

I have encountered this issue and I tried the accepted answer, which didn't work for me. As this question turns up high on Google results, I'm offering my solution in the hope that it helps others in my situation.

In my case, the mysql-client package was not installed. apt-get install mysql-client fixed Drush for me.

Why didn't I have the mysql-client package installed on a Drupal development machine? I'm developing on Windows and using WSL for Drush purposes.

-1

Setup an alias for your site in the alias.drushrc.php file. Make sure MySQL executable is in your path variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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