We use cookies to improve our services and provide a better experience. By continuing to use this site, you agree with our Cookies Policy.


More than 400 step-by-step articles to guide you through online project development.
HomeTutorialsCMS TutorialsDrupalDrupal Administration

How to reset admin password in Drupal 7

Cloud Servers 727 x 90

In order to reset Drupal 7 administrator password you will need to follow the steps described below:

  • Make a copy of index.php file in your Drupal directory and add following code after the line “drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);”:
  • 1
    require_once 'includes/password.inc';
    echo user_hash_password('your_new_password');
  • See the image below:
  • password-hash-generate-drupal

  • Open the copy of the index.php file with the newly added code. You will notice a newly generated hash key which you will need to use in the database, see the image below:
  • password-hash-generated-drupal

    The generated code is a hash code of a password “your_new_password“.

  • Save the generated code and access your database. Using shell you can change the password by using following sql query:
    UPDATE `your_drupal_database`.`drup_users` SET `pass` = 'hash_code_you_generated' WHERE `drup_users`.`uid` =1;

    If you want to change the password over the phpMyAdmin you will need to find table called “drup_users” and insert new hash code into the field “pass” for your administrator user. See the image below:

  • sql-update-password-drupal

  • Save the entered data to change your password and remove the copy of index file to finish the setup and use your new password to login to your administration panel.
Rate this Tutorial:
No Comments Leave a Comment
Leave a Comment

Cloud Servers 1 230×230

Other (195)

Popular Keywords

Web Banner 1 230×230