Skip to content

Instantly share code, notes, and snippets.

@punyaruchal
Created August 24, 2021 11:06
Show Gist options
  • Save punyaruchal/433c545e7fea6707ef47d1a16212fc4d to your computer and use it in GitHub Desktop.
Save punyaruchal/433c545e7fea6707ef47d1a16212fc4d to your computer and use it in GitHub Desktop.
Drupal 7 and 8 admin password reset

Reset Drupal admin password

  • Log into Mysql or login using PhpMyadmin and go to your respective database
  • Find the users_field_data table
  • Find the user that is related to you.
  • Log into your terminal
  • Go to your Drupal projct main directory
  • Run this command
php core/scripts/password-hash.sh “NewPasswordHere”

It will create a hash of password and it can use in database.

  • Go back to your DB table
  • Replace the pass value with your new hash. Save/update your table’s row.
  • Go to flood table in DB (if you are running a non-production server, simply truncate this table, otherwise look for anything that is flagging your IP with logging in. delete those records.)
  • Go to cache_entity table in DB (if you are running a non-production server, simply truncate this table, otherwise look for anything that is flagging your IP with logging in. delete those records or clear cache by drush using the drush cr commands.)
  • Now you should be ready to log in with the new password. Go your login page on your site and try again!

Or follow the link to reset password via drush: https://www.siteground.com/kb/reset_drupal_admin_password/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment