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

Tutorials
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

USA VPS
OpenVZ VPS
Brazil VPS
Ubuntu VPS
Linux KVM Hosting
cPanel KVM
Linux Cloud Server
Germany Cloud Servers
Windows Cloud Server
KVM VPS

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
    2
    3
    
    require_once 'includes/password.inc';
    echo user_hash_password('your_new_password');
    die();
  • 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:
    1
    
    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.

OpenVZ VPS
Windows Cloud Server
Linux KVM Hosting
Linux Cloud Server
USA VPS
cPanel KVM
Ubuntu VPS
Brazil VPS
KVM VPS
Germany Cloud Servers
Rate this Tutorial:
No Comments Leave a Comment
Leave a Comment

Other (195)

Popular Keywords