In this tutorial, you will learn how to reset the Sitecore admin password using a handy SQL script. One of the most frustrating things that can happen in CMS development is setting up a new CMS instance, changing the password for the default admin account and then forgetting what you changed it to. After being locked out, your only option is to re-install the CMS πŸ˜”

If you have fallen victim to this annoyance, there is hope 😊. You may be able to avoid having to re-install a new instance. Using some handy SQL it is pretty easy to reset the default Sitecore admin's password back to b. If you want to save yourself some time by resetting the admin password, read on πŸ”₯πŸ”₯πŸ”₯

It should be noted that the SQL snippet that I am about to share with you, will only work on the default admin account. If you run the snippet against another user account, it won't work. The reason why this script only works on the admin account is that the values have been copied from the admin account on a vanilla Sitecore instance. Sitecore creates a unique salt and uses that salt whenever a new password is generated. As soon as you change a users account you will not know the salt for the password. As we can access the salt and the password hash for the admin account from a vanilla Sitecore instance, we can use those values to reset the admin account in a different instance. In Sitecore, member data is stored within the aspnet_Membership table. All we need to do is replace the admin account with details from a vanilla database and you should be able to log in againπŸ’₯

This SQL statement will reset the password to a known state. The SQL updates the database based on the GUID of the user. In this snippet, the admin user is updated. This value is retrieved from the aspnet_users table. The snippet then updates the password to qOvF8m8F2IcWMvfOBjJYHmfLABc=. This is the hashed value for the letter b. Using this value you should let able to log into the CMS with admin and b. If this fails and you have a database backup before where you know the username and password combo, repeat the process and you should be able to access Sitecore 😊


Happy Coding 🀘