I installed Drush 7 using Composer, and I created a Drupal 8 running on XAMPP on Windows.

  1. H:\xampp\htdocs\d8_test is the Drupal root.
  2. Location of settings.php file is H:\xampp\htdocs\d8_test\sites\default\settings.php.

None of the drush commands are working. All are failing with the same error:

H:\xampp\htdocs\d8_test>drush pmi
Command pm-info needs a higher bootstrap level to run - you will need    [error]

to invoke drush from a more functional Drupal environment to run this
The drush command 'pmi' 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
 * 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        :  8.0-dev
 Site URI              :  http://default
 Database driver       :  mysql
 Database username     :  root
 Database name         :  d8_test
 PHP executable        :  php.exe
 PHP configuration     :  H:\xampp\php\php.ini
 PHP OS                :  WINNT
 Drush version         :  7.0-dev
 Drush temp            :  Z:\Temp
 Drush configuration   :
 Drush alias files     :
 Drupal root           :  H:/xampp/htdocs/d8_test
 Site path             :  sites/default
 Active config path    :  sites/default/files/config_MoeSD5C7JSguok
 Staging config path   :  sites/default/files/config_MoeSD5C7JSguok

Contents of my settings.php

$databases['default']['default'] = array (
  'database' => 'd8_test',
  'username' => 'root',
  'password' => '',
  'prefix' => '',
  'host' => '',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',

Note that host of my MySQL installation is instead of localhost.

Also note that H:\xampp\php\ is added to my PATH variable, so php.exe refers to H:\xampp\php\php.exe.

The output of drush sql-connect is the following:

mysql --user=root --password= --database=d8_test --host= --port=3306


2 Answers 2


The output of drush sql-connect is mysql --user=root --password= --database=d8_test --host= --port=3306. Now, when I directly execute this command, it didn't work because mysql.exe was not there in the system PATH. So I added H:\xampp\mysql\bin to PATH (environment variable in Windows) and then it worked!

  • Looked for this answer a long time. Thanks for it.
    – bumpaw
    Commented Sep 2, 2016 at 19:38
  • Excellent, it was what I needed. Commented Jun 15, 2019 at 3:59

Make sure mysql-client-core-5.5 package is installed.

On Ubuntu:

sudo apt-get install mysql-client-core-5.5
  • 3
    I had forgotten that (since the MySQL database was running on a separate server) drush requires the mysql-client package to connect. Just had to install that, and drush commands are working normally! Commented Feb 28, 2015 at 20:49
  • I had the same problem. Commented Jun 20, 2015 at 11:22

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