Tamer Zoubi @ Drupal 8


Drupal expert | Programmer

restore admin password

How to reset admin password in Drupal 7

Previously for Drupal 6 site, when you forgot or didn't know the admin password, you could easily change it via database by following query:

UPDATE users SET pass = MD5('mynewpassword') WHERE uid = 1; 

However if you tried that in Drupal 7 site you will see it doesn't work! Thats because Drupal 7 stores a salted SHA512 hash instead of MD5 hex hash. To get new password you must use the user_hash_password('mypassword') function (located in includes/password.inc), then paste it into the database.

Tags
Drupal 7
reset password database
restore admin password