Saturday, September 16, 2017

Drush was not able to start (bootstrap) the Drupal database.

I have struggled lot to resolve "Drush was not able to start (bootstrap) the Drupal database..." issue in Drupal 8. Finally, after burning the midnight oil I have found solution as below.

My laptop configuration: PHP 7, WAMP 3, Windows  7 and 10

The main reason of such issue is PATH variable. You need to add your MySQL and PHP path in system PATH variable. To check, you should close your command shell and restart. It will start using updated PATH variable

In my system, I am having WAMP  3. Path for PHP and MySQL path as below


 Credit goes to

Sunday, September 3, 2017

Resetting Admin password in Drupal 8

Option 1

drush sqlq "select name from users where uid=1"
drush upwd admin --password=pass


Option 2

Generate Password hash

php core/scripts/ 'your-new-pass-here'

Update in database

UPDATE users_field_data SET pass='$S$E5j59pCS9kjQ8P/M1aUCKuF4UUIp.dXjrHyvnE4PerAVJ93bIu4U' WHERE uid = 1;

Update cache

DELETE FROM cache_entity WHERE cid = 'values:user:1';

Saturday, August 19, 2017

To create new user from Drush command

To create new user using Drush use below command from Drush

drush user-create admin --mail=""  --password="admin"
Admin is the username
mail is the email address
and Password

Remove all contents from Drupal 8

To remove all contents, taxonomies, users and other content element. I would recommend to use delete_all module. Available in Drupal 7 and Drupal 8

Tuesday, August 8, 2017

Get all terms from the vocabulary

To get all terms from the specific vocabulary use below snippets

$vid = 'name_of_vocabulary';
$terms =\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid);
foreach ($terms as $term) {
 $term_data[] = array(
  "id" => $term->tid,
  "name" => $term->name

Friday, July 28, 2017

Install Drush using composer for Drupal 8 in Windows 7 OS


Composer need to be available in your windows machine

Update composer with below package

composer require symfony/var-dumper:v2.7
composer remove phpdocumentor/reflection-docblock:3.1.1
composer remove drush/drush:8.x-dev

Note: If you still face an issue, read composer error message, it provides details about what is missing in your installation.
for example 

Problem 1
    - Installation request for drush/drush 8.x-dev -> satisfiable by drush/drush[8.x-dev].
    - drush/drush 8.x-dev requires phpdocumentor/reflection-docblock ^2.0 -> satisfiable by phpdocumentor/reflection-docblock[2.0.0, 2.0.0a1, 2.0.0a2, 2.0.0a3, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5] but these conflict with your requirements or minimum-stability.

Saturday, July 8, 2017

Install drupal console using composer

To install Drupal Console using composer for Drupal 8, use below command from command prompt

composer require drupal/console:~1.0 \
--prefer-dist \