Forgotten Password - Reset it Using phpMyAdmin

Published August 4, 2009

When developing a Drupal site, sometimes you have the need to reset a password - either for yourself or another user. Often, when working with a copy of live data, I want to be able to login as another user who is already in the system. Rather than asking them for their password, I use this method to change it.

While Drupal's built-in "reset password" functionality or user editing capabilities work great, if you're like me and tend to work with your database editor open, there's a quick-and-dirty way to quickly change a user's password.

Using phpMyAdmin, navigate to Drupal's "user" table and navigate your way to the user record you're interested in. Click to edit the record then type in the new password in the password field.

Here's where the magic comes in - before you hit "submit", change the "function" select box to "MD5" - this will encode the plaintext password using the MD5 hash - the same one Drupal uses. If you don't perform this step, Drupal will be trying to compare a plaintext password against a hashed password - they'll never match and the password won't work.

Comments

Great tip.

Once you get used to working with the database,
it's alot easier to do user & site maintenance.

Submitted by Guest (not verified) on Thu, 10/15/2009 - 21:44

doesn't work!

Submitted by Guest (not verified) on Wed, 09/07/2011 - 06:51

For Drupal 7, execute this command from the root of your Drupal directory:

./scripts/password-hash.sh mynewpassword

... where "mynewpassword" is the new password you choose. Then you have a slated hash to put into the database either via command line or PHPmyAdmin

Submitted by Guest (not verified) on Sat, 05/19/2012 - 14:35

Sign up to receive email notifications of whenever we publish a new blog post or quicktip!

Name
CAPTCHA