How to login to a Drupal site with user/1 if the password got lost?

1
0
-1

Assume a Drupal site for which the password for user/1 (= the super user) got lost or is unknown (e.g. because you're the new admin, and the previous one has moved on)?

Topics: 

Category: 

2 answers

1
0
-1
This one is the BEST answer!

If you can't find a way to access the eMails as explained in the previous answer, and if anything else fails, and you need to find a solution badly, a possible solution that may get you going again is to "edit raw database records." (generally perceived as "Blind hacking which may break things and not fix them"). If you're in the mood for that, read on ... and try these alternatives (if your available infrastructure allows you to do so):

  • find a way to perform an edit (using something like PhpMyAdmin) of the database table that contains the eMail Id related to the user with uid=1, and adapt that eMail Id to your own eMail Id. Then continue as I suggested above.
  • find a way to perform an edit (using something like PhpMyAdmin) of the database table that contains the roles granted to any of the users that are able to login to the site, and adapt these data to grant such user an admin role. Then login with that userid, and do what's needed (reset password or edit the eMail Id) for the original userid you're trying to get to work again.

1
+1
-1

As of D7 passwords are hashed, and it is pretty much a waste of time to try to get around those hashed passwords. If eMail is working in your site, ask for a password reset link. Use that link to then reset the password. If you're lucky, the eMail Id registered for the account you want to access is your eMail Id. If it is not, maybe you can contact the eMail Id and ask for the eMail with the password reset link to be forwarded to you.