Reset a Lost Drupal 6 Administrator Password

tutuploadsmedia_1328733261326.png

The User 1 account on a Drupal site has special status. This account has life and death rights on your Drupal installation and needs to be protected at all costs. If you’ve lost access to this account, then it is important to regain that access.

Your first step should be to try and reset your password by adding this to your site’s URL: /user/password/. If that doesn’t work or if you don’t know the email for the account, then you can manually reset your password in the database. This tutorial will show you how to do it.

Click here for this tutorial in Drupal 7.

Step 1. Access your database

tutuploadsmedia_1328733261326.png
  • Access your database. In this example we’re going to use phpMyAdmin. If you’re using commercial hosting then phpMyAdmin will be accessible from your hosting control panel. On XAMMP and other local apache installations you also have methods for getting to phpMyAdmin.

tutuploadsStep_3._Choose_the_correct_data_base.png
  • If you have more than one database, be sure to select the correct one to work with from the left hand column.

Step 2. Choose the correct table and browse to the entry

tutuploadsStep_4._Choose_the_correct_table_and_browse_to_the_entry.png
  • Scroll down and click on the users table. Choose the Browse tab at the top of the right hand panel.

Step 3. Open the entry to make changes

tutuploadsStep_5._Open_the_entry_to_make_changes.png
  • Scroll down to see your user entries. The headers may be kind of large and it looks like empty tables. The users are listed below the headers.
  • Find user 1 – the user number is next to the user name. Drupal always makes User 1 the administrator. Click here to find out more about User 1.
  • Click the pencil-edit icon.

Step 4. Choose MD5 and type in a new password

tutuploadsStep_6._Choose_MD5_and_type_in_a_new_password.png
  • Select MD5 from the dropdown menu.
  • Type in a brand new password.
  • If you’re done, you can scroll to the bottom of the page and click “Go” and your password will now be changed.

tutuploadsmedia_1328734185604.png
  • After you click “Go” you will see that the password has been encrypted. It has been changed and you can now log in with your new password.

Step 5. Changing the user email

tutuploadsStep_6._Changing_the_user_email.png
  • To change the email, type a new email in the mail field. There is no need to make a selection from the drop down box if you are changing the email.
  • Click Go to save your changes.
  • You can do this at the same time as resetting the password, or in a separate step.

If you’re a database pro …

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.

Note: This method only works with D6. D7 uses a different encryption method.

 

Author

  • Steve Burge

    Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

0 0 votes
Article Rating
Subscribe
Notify of
2 Comments
Oldest
Newest
Inline Feedbacks
View all comments
root_india
root_india
11 years ago

What is its not working ?? I tried well but unable to login. ??

Patrick
Patrick
6 years ago

Hi, I followed the tutorial, but it does not work. I changed the name, the pass & the e-mail, but I still get the message the username or password is unknown.

2
0
Would love your thoughts, please comment.x
()
x