Friday, July 29, 2011

Drupal reset super user (admin) password

To reset Admin password in Drupal7 , there is a drupal hash script to generate a password hash from plain text.

To set new password for user 'admin' to 'mynewpass', then first in the drupal root directory, run the script:
$ ./scripts/ 'mynewpass'

Then it will echo something like this:

password: mynewpass        hash: $S$CGM3hk.Fvl/pQlirfJmIQiXMOdifVR.wPoyT9e81ktxAStq7pmGK

then use following SQL to update the password:

UPDATE users SET pass='$S$CGM3hk.Fvl/pQlirfJmIQiXMOdifVR.wPoyT9e81ktxAStq7pmGK' where uid=1;
//Drupal use uid=1 for super user (Site administrator)
For drupal6 , output of md5('mynewpass') will work.

Hope this helps!

No comments:

Post a Comment