Unlock Your Sitecore User Account Using SQL Server

January 22, 2023

Sometimes, our Sitecore account may become locked out due to incorrect password attempts, making it impossible to log in, even if we remember the correct password. As per Sitecore, our accounts get locked out after 5 invalid attempts. This can happen with the Sitecore admin or any user account. As you can see in the image below, my account is locked out (IsLockedOut=1) and I am unable to log into Sitecore.

Unlock Sitecore User Account Using SQL Server

Unlock Sitecore User Account Using SQL Server

However, we can easily unlock Sitecore admin or any user account using a straightforward SQL query.

Steps To Unlock Sitecore Admin Account Or Any User Account

Step 1

Log into the SQL server instance using SQL Server Management Studio(SSMS) and select the Sitecore instance’s core database to run the query.

Unlock Sitecore User Account Using SQL Server

Step 2

Copy and run the below SQL query.


UPDATE  aspnet_Membership 
SET     IsLockedOut = 0, 
        FailedPasswordAttemptCount = 0
WHERE   UserId IN (SELECT UserId FROM aspnet_Users WHERE UserName = 'sitecore\Admin')

To unlock any other account just replace the UserName value. For example, in my case, instead of 'sitecore\Admin' it will be 'sitecore\hsingh’.

You can also look for your UserName in aspnet_Users table.

Unlock Sitecore User Account Using SQL Server

Now you can log into Sitecore using the old correct password. If you do not remember your Sitecore admin password, please refer to How To Reset The Sitecore Admin Password To b From SQL Server.