My site is on localhost and I have access to database too. This is the structure of "users" table:

enter image description here

The password field is of type "varchar(32)" having collection "utf8_general_ci". I tried to decrypt the password online but it displays that password can't decrypted.

I manually updated the table and changed the password using md5 but whenever I try to login to the site as admin, it displays "Access Denied".

How to change the password for site?


Option 1 - Ask for a password reset link

If eMail is working in your site, ask for a password reset link. Use that link to then reset the password.

Option 2 - Use Drush

If you have Drush available, then you can use eiher of these Drush commands:

  • drush upwd --password="NewPsw" "username", to reset the password for username to NewPsw.

  • drush uli username, to generate a 1 time login link for username.

Option 3 - Copy an encrypted password that you know

Just copy the encrypted password from the same user table from any other user for which you know the password. Then paste that encrypted password in the record for your admin user. You should then be able to use that password for login with your admin user.

If you don't have another user yet (or don't know any of their passwords), then use standard Drupal facilities to create a new user first (and remember the new user's password).

If you don't have any user that is allowed to create new users (or you can't login with such new user), then (temporarily) create a new Drupal site and use the user/1 password of that new site.

Option 4 - Create a new admin user

Insert a new user in the "user" table (with an encrypted password for which you know the password). And make that new user an administrator also by inserting an appropriate row in the "user_roles" table (cloned from the row related to the user/1).

Then use the newly created user to perform a reset of the password for the admin user.

  • 1) emaill is not working so can't ask for reset password. 2) I copied a known password but but when i try to login it specifies that "404 the page is unavailable" 3) I created a user in db and assign role id similar to admin and set status to 1 but when i try to login it represents "Sorry,Unrecognised Username or password ". – Rajender Rajan Oct 5 '15 at 9:40
  • 1
    As per your "2)" comment: that appears to me that your login succeeded, but that you ran into a new/other problem. Which might be caused by "clean URLs not setup correctly" and/or by "a cookie problem". Try "2) again using another browser. If another browser works, then it is a cookie problem"(delete the cookie in your regular browser and try again). Otherwise verify your "clean URLs" setup. – Pierre.Vriens Oct 5 '15 at 10:03
  • Not working..i tried on another browser but it still saying "Unrecognized User or password" – Rajender Rajan Oct 5 '15 at 10:09
  • I more thing i want to share that i changed the email id of admin so that i can send a reset email to my email plus i decryped password through online tool but when i enter my email and old password it specifies "Access Denied" – Rajender Rajan Oct 5 '15 at 10:14
  • Some more options to consider for further debugging your issue: look at my answer to drupal.stackexchange.com/questions/171746/… – Pierre.Vriens Oct 5 '15 at 10:30

Install Drush and use drush uli from within the site directory; you'll get a login URL you can use to log in and change your password.

The URL will start with http://default unless you set $base_url in settings.php or use the -l option to Drush to correct it.

Just replace default with your local IP etc.

  • i tried drush uli but does't working – Rajender Rajan Oct 5 '15 at 9:46
  • 1
    Hi Rajender. Sounds like you are debugging multiple issues here, with broken Drush / no clean URLs etc. Might be time to take a step back and see what is wrong with the local setup? – Chris Burgess Oct 5 '15 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.