Drush is not able to bootstrap I installed Drush 7 using Composer, and I created a Drupal 8 running on XAMPP on Windows.


H:\xampp\htdocs\d8_test is the Drupal root.
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&gt;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
command.
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
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.

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
 directory
 Drush configuration   :
 Drush alias files     :
 Drupal root           :  H:/xampp/htdocs/d8_test
 Site path             :  sites/default
 Active config path    :  sites/default/files/config_MoeSD5C7JSguok
                          xrBh4-UuwT_r9_jk2Z59QKdN-j9Zx9DIgHBy2dH8n
                          1rGOeKNJpaAAxBi4PzA/active
 Staging config path   :  sites/default/files/config_MoeSD5C7JSguok
                          xrBh4-UuwT_r9_jk2Z59QKdN-j9Zx9DIgHBy2dH8n
                          1rGOeKNJpaAAxBi4PzA/staging


Contents of my settings.php

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


Note that host of my MySQL installation is 127.0.0.1 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=127.0.0.1 --port=3306
The output of drush sql-connect is  mysql --user=root --password= --database=d8_test --host=127.0.0.1 --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!