Reliable Hosting With the Best Customer Support

Looking for a dedicated hosting solution with 24/7/365 U.S.-based, English speaking phone support? Visit Rackspace for a reliable, managed hosting solution that will let you focus on the bottom line - your business, while they make sure your website stays online.

Free Logo Creator

Logo creation is a long, drawn-out creative process that can cost millions. But a good logo doesn't have to cost a fortune, and you don't even need to hire a professional design team. Check out Logo Creator (Win | Mac) to get started, read our article on obtaining your own Free Logo Creator.



Jun 16 2008

How to Reset Drupal Admin Password


Filed under: Content Management Systems » Drupal,
Tools:

Loose your Drupal admin password?

There's nothing more frustrating than updating your Drupal site only to be unable to login, and not having your admin password, therefore effectively locking you out of your site entirely. The first thing to try is to click on the lost password link, and have the password emailed to you. There is, however, a couple scenarios where this will fail to work:

  • This won't work if you're unable to access the retrieve password page.
  • This won't work if you've stored an old, no longer in use email address for the admin user (user 1).

In these cases, there are two ways to regain access to your Drupal site. The first resets your Drupal admin password (the password used by user 1), the second retrieves it. You'll need access to your mysql database (via phpMyAdmin, for example) for both methods, but only the first one involves executing a mySQL function.

Resetting your Drupal admin password

To directly reset your password, log into phpMyAdmin and execute the following mySQL statement:

UPDATE users SET pass = md5('newpassword') WHERE uid = 1;

Enter your new password in the md5 function - it will automatically be converted via a one-way hash (this is why we can't retrieve your old password - the decryption is a one-way process). Note that for earlier versions of Drupal you may need to use SET password, instead of SET pass.

This will effectively reset the Drupal admin password for user 1. Note that you can use this to reset the password of any user, although this is typically unnecessary as you should be able to simply log in as admin user (user 1), under which you have the ability to reset any user's password.

Retrieving your lost Drupal admin password

An alternative to resetting the password is to retrieve it. This method only applies to the second problem above, that is, you are able to access the retrieve password page, but you're email address is outdated. To do this, simply update the email field for the admin user (user 1) in the "users" table. Unlike the password field, you can directly edit the email field without consequence. Once you've updated your email address for the admin user, simply go to the request password page to have your password emailed to your email address.

Average: 4.9 (16 votes)
Select your preferred way to display the comments and click "Save settings" to activate your changes.

Awesome! I'm back in Drupal

Whew - I was going through all my files trying to find my darn password and couldn't for the life of me remember what it was. The MD5 function in mySQL worked like a charm (the forgot password request page didn't - for some reason the email never got sent out).

Thank you!!

Really very quick solutions

Nice - got be back up and running in no time. Thanks man...

Saved the day

Thanks so much.

I've been working in a virtual machine without a mail server and needed to reset the admin password. This did the trick nicely.

- Andy

Phew!!! saved a lot of headaches

Thanks for the great tip. I just started working with Drupal. I have the development install on my laptop with MAMP and forgot my password. The MD5 hint worked like a charm.

-Naveen

In a couple of clicks

In phpMyAdmin go to your drupal database, click on users. Find the user called admin, check the box then click the change icon. In the "pass" field you'll see a long string of characters the MD5 hashed password.

Set the password to a known value:
- password = "this is the MD5 hashed password"
------------------------------------------------------
- admin = 21232f297a57a5a743894a0e4a801fc3
- secret = 5ebe2294ecd0e0f08eab7690d2a6ee69
- OU812 = 7441de5382cf4fecbaa9a8c538e76783

Paste the hashed password into the field, save the change, and log-in using the new password.

Immediately change your password to something more secure!

md5 translation

I was editing directly into the user pass field over and over again. Even went to this site so I could type my pass and get the md5 translation and enter that. So frustrating. I just executed your example and was done in 2 seconds. grrr. Thank you.

Thx

Thank you.

THANKS

Very useful bit of code, many thanks!

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options

CAPTCHA
This question is used to make sure you are a human visitor and to prevent spam submissions.