Skip to main content

Posts

Showing posts from April, 2013

Recover password in Drupal 7

In Drupal6 all we had to do to replace the password from the database was to encode the password with the MD5 algorithm and update the record of the users table. In Drupal 7, thanks to the new variable $drupal_hash_salt all this changed. According to the article Recovering your Drupal 7 administrator account password all we have to do is execute from the command line the command below from inside the root directory of Drupal: ./scripts/password-hash.sh newpwd where newpwd will be the new password plaintext. If we don't have access to the command line or for any reason the script doesn't get properly executed, we may create a file eg. pass.php with the following code: Whichever method you may use, you will get a hashed string. All we then have to do is execute the following SQL query: PS: In case we have drush installed in server and have access to command line, we may also execute the following commands: