Reset the admin (user #1) password in Drupal 9

Last modified on July 24, 2026 • 1 min read • 57 words
I should upgrade to Drupal 9.
Reset the admin (user #1) password in Drupal 9
Image by Sixeleven, source: Seek Vector Logo 

I have been playing around with Drupal 9 and forgot the admin password. If this happens to you, go to the base folder of the drupal installation.

  1. Generate the hash for your password:
php core/scripts/password-hash.sh 'newpasswd'
  1. Execute in mysql:
UPDATE users_field_data SET pass='hash_result_from_previous_command_goes_here' WHERE uid = 1;
  1. Clear the cache:
DELETE FROM cache_entity WHERE cid = 'values:user:1';