Search code examples
drupalcommand-linedrupal-8drush

Is it possible to change Drupal8 admin password using Drush?


Is it possible to change Drupal8 admin password using Drush? Or fetch the password in any other way.

I have forgot the administrator password for the local Site. I can access the database and also able to access the user related table. As in my localhost there is no smtp server setup I am unable to get email using forget password.

If anyone have any idea to fetch the password or reset it, thus I could able to use the password. Please let me help with your valuable suggestions.


Solution

  • I had tried several time the flood table got several records and blocked the user. To clear the data and unblock the user I have used the following drush command

    drush sqlq "DELETE FROM flood"
    

    Then I had run the following command to reset password

    drush upwd --password="mypassword" "admin"
    

    After that I was able to login into the site.

    I got some help from drupal community and the following post Recovering the administrator password