Reset drupal 7 admin password


One of my developer left the drupal project in middle, he didn’t told me the drupal admin password.After long search i get the code to reset drupal 7 admin password.This trick will works if you have access to ftp and database of your server.

well in previous version of drupal you can easy reset the password using md5 hash but in drupal 7 it use salted sha512 hash, so to get salted sha512 hash of your password you need to follow some steps

Steps To Reset Drupal 7 admin password

  1. Create a reset.php with your text editor or developer ide.Place the content write below in it.

    Replace the “my_new_password” with the password you want to set.
  2. Upload this file in root of your drupal project.
  3. Access this file from browser.You will get the hash of your password.
    Copy the password hash.
  4. Open phpmyadmin. Goto your drupal database.

    if you don’t know what database your drupal is using then open configuration file at sites/default /settings.php
    and find database name in $databases variable.

    After that either execute the following query[sql]UPDATE users SET pass = md5(‘password hash’) WHERE uid = 1;[/sql]or proceed further.

  5. Click on the users table.
    edit the admin row.

  6. Paste the password hash in pass field.

Now Login With Your New Password