Drupal is a powerful CMS and just like parking your car, we all occasionally leave the keys inside. So how do you reset the admin Drupal password? There are a couple of ways depending on your specific situation.
Option 1 – If you have access to the associated email account
- Open Drupal login page. Usually, the URL path is โ/userโ;
- Click on the โRequest new passwordโ link/button or go directly to the password reset page, the path is โ/user/passwordโ;
- Enter the email address or username and press โSubmit/Log inโ button;
- Check your email(including spam folder). Login to the website using one-time login link.
- Enter new password and save.
Option 2 – Using Command Line If you have no access to the associated email account
To change the user password on your Drupal 8 website use the Drush Command Shell.ย
Drush is a command line shell and Unix scripting interface for Drupal. Drush core ships with lots of useful commands for interacting with code like modules/themes/profiles. Similarly, it runs update.php, executes sql queries and DB migrations, and misc utilities like run cron or clear cache.
For Drupal 8.5
Make sure you are using Drush 9:
drush user-password USERNAME PASSWORD
or generate one time login link:
drush user-login
An alternative option is using Drupal Console
drupal user:password:reset
For Drupal 7 websites and older versions of Drush
drush upwd admin –password=PASSWORD
Option 3 – Using MySQL database management application
You can use phpMyAdmin, Sequel Pro, TablePlus, or any other database management application.
For Drupal 6/7/8
You can replace a user’s email address with yours and then begin a regular password reset procedure using a browser.
Or if you have another user/website and you know a password you can copy password hash from it.
For Drupal 6/7
In the SQL query text field, type the following text: โupdate users set pass=md5(PASSWORD) where uid = 1.โ