I have added one field in the content type. So when trying to export configuration it gives an error

$ pwd
$ /c/xampp/htdocs/Test/docroot/sites/testone.com
$ ../../../vendor/bin/drush config:export --uri=test.com

Command config:export was not found. Drush was unable to query the database. As a result, many commands are unavailable. Re-run your command with --debug to see relevant log messages.

Other Information are below:

$ ../../../vendor/bin/drush status --uri=test.com
Drupal version : 8.6.17
Site URI       : test.com
DB driver      : mysql
DB hostname    : xxx
DB port        : xxxx
DB username    : xxxxxx
DB name        : xxxxxx
PHP binary     : C:\xampp\php\php.exe
PHP config     : C:\xampp\php\php.ini
Drush script   : C:/xampp/htdocs/Test/vendor/drush/drush/drush
Drush version  : 9.4.0
Drush temp     : C:\Users\xxxx\AppData\Local\Temp
Drush configs  : C:\xampp\htdocs\Test\vendor\drush\drush/drush.yml
Drupal root    : C:\xampp\htdocs\Test/docroot
Site path      : sites/testone.com

DEBUG Details

$ ../../../vendor/bin/drush cex -l testone.com --uri=test.com --debug
 [preflight] Config paths: C:\xampp\htdocs\Test\vendor\drush\drush/drush.yml
 [preflight] Alias paths: C:\xampp\htdocs\Test\docroot/drush/sites,C:/xampp/htdocs/Test/drush/sites
 [preflight] Commandfile search paths: C:\xampp\htdocs\Test\vendor\drush\drush\src
 [debug] Bootstrap further to find cex
 [debug] Trying to bootstrap as far as we can
 [bootstrap] Drush bootstrap phase: bootstrapDrupalRoot()
 [bootstrap] Change working directory to C:\xampp\htdocs\Test/docroot
 [bootstrap] Initialized Drupal 8.6.17 root directory at C:\xampp\htdocs\Test/docroot
 [bootstrap] Drush bootstrap phase: bootstrapDrupalSite()
 [bootstrap] Initialized Drupal site test.com at sites/testone.com
 [bootstrap] Drush bootstrap phase: bootstrapDrupalConfiguration()
 [debug] Add service modifier
 [info] sql-query: SELECT 1;
 [info] Executing: mysql --defaults-file="C:\\Users\\XXXXXXXX\\AppData\\Local\\Temp\\dru3652.tmp" --database=XXXX --host=XXXX --port=3306 --silent  < "C:\\Users\\XXXXXXXX\\AppData\\Local\\Temp\\dru3641.tmp" > nul
 [bootstrap] Drush was not able to start (bootstrap) the Drupal database.
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.
More information may be available by running `drush status`
 [debug] Bootstrap phase bootstrapDrupalDatabase() failed to validate; continuing at bootstrapDrupalConfiguration()
 [debug] Done with bootstrap max in Application::find(): trying to find cex again.

In Application.php line 238:

  Command cex was not found. Drush was unable to query the database. As a result, many commands are unavailable. Re-r
  un your command with --debug to see relevant log messages.

Exception trace:
 () at C:\xampp\htdocs\Test\vendor\drush\drush\src\Application.php:238
 Drush\Application->bootstrapAndFind() at C:\xampp\htdocs\Test\vendor\drush\drush\src\Application.php:191
 Drush\Application->find() at C:\xampp\htdocs\Test\vendor\symfony\console\Application.php:236
 Symfony\Component\Console\Application->doRun() at C:\xampp\htdocs\Test\vendor\symfony\console\Application.php:148
 Symfony\Component\Console\Application->run() at C:\xampp\htdocs\Test\vendor\drush\drush\src\Runtime\Runtime.php:112
 Drush\Runtime\Runtime->doRun() at C:\xampp\htdocs\Test\vendor\drush\drush\src\Runtime\Runtime.php:41
 Drush\Runtime\Runtime->run() at C:\xampp\htdocs\Test\vendor\drush\drush\drush.php:66
 require() at C:\xampp\htdocs\Test\vendor\drush\drush\drush:4

But when I run drush status command, it works. Is there any step m missing?

  • 1
    A piece of advice: Always include the version of Drush and Drupal you are using, and maybe the output of drush status. And when you are told to "Re-run your command with --debug", you should do that and post the output. It makes it so much easier to help you. Happy Drushing!
    – hansfn
    Jul 12, 2019 at 5:32

3 Answers 3


You are targeting a multisite instance. So you need to add the -l option to tell Drush what site you are targeting at. Otherwise Drush will try to target the default site.

drush cex -l testone.com --uri=test.com

The --uri option is to tell Drush what base path to use, for example for generating the sitemap, which isn't known to PHP when triggering code from the command line instead of from within a browser.

  • thanks for the reply. I tried exactly what you told. But still, it gives the same error.
    – Sudha
    Jul 12, 2019 at 12:16
  • @Sudha – Can you maybe add the output of drush cex -l testone.com --uri=test.com --debug then to your question? And do you maybe use a settings.local.php file?
    – leymannx
    Jul 12, 2019 at 12:50
  • I have added debug result and yes I m using settings.local.php file
    – Sudha
    Jul 12, 2019 at 13:44
  • @Sudha – OK. What happens when you move the database credentials from the settings.local.php to the settings.php? Any changes?
    – leymannx
    Jul 12, 2019 at 14:14
  • My database credential is in settings.php. No changes
    – Sudha
    Jul 12, 2019 at 14:18

Finally, I found the solution for the above "** ERROR: Drush was not able to start (bootstrap) the Drupal database**". In short, drush was not able to communicate with MySQL.

Solution: Add a new system environment variable in the path "C:\xampp\mysql\bin" and restart gitbash. Then try to run above command. It works properly :) . Hope it may help someone.


The command config:export only works if Drush is able to connect to your site or your site's database to be 100% correct. If you aren't connected, the command is reported as not found.

Added: I missed the part about multisite. leymannx's answer is much better.

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.