How to recover SQL Server SA password

There will be a situation when you would be so desperate to reset or recover SQL Server SA password, like when you are back from a long vacation and have forgotten the SA password 😉  or someone else changed it in your absence or somebody hacked your SQL Server. This is actually a terrific moment for a DBA, I have personally never faced it but I know how to overcome this. Are you wondering “How to recover SQL Server SA password ?” No rocket science, just couple of steps you need to remember that’s all. It’s always advised to keep another sysadmin account with you other than regular SA.

Step 01:
Login into the server (where your SQL Server instance is installed) as an administrator or with some highest privileged credential.

Step 02:
“Start’ → Find “SQL Server Configuration Manager”
OR
“Start’ → “All programs” → “Microsoft SQL Server 2012” or 2008 →  “Configuration Tools”  → “SQL Server Configuration Manager”

recover-sa-password-01

Step 03:
“SQL Server Services” → Right click on “SQL Server” service → “Properties”

recover-sa-password-02

Step 04:
“Advanced” → Double click on “Startup Parameters” to enable editing → At the end put “;-m” to enable the single user admin mode. → “Apply” → “OK”

recover-sa-password-03
put ;-m at the end of the text to enable the single user admin control

recover-sa-password-04

Step 05:
Restart “SQL Server” and dependent “SQL Server Agent” service

recover-sa-password-05

Step 06:
“Start” → “CMD” (Right click) → “Run as Administrator”

recover-sa-password-06

SQLCMD -E -S”DON-PC\BEINGME”
ALTER LOGIN SA WITH PASSWORD = ‘newsapassword’
GO

recover-sa-password-07

Step 07:
Remove the parameter “;-m” that you have added in “step 04” → “Apply” → “OK”
→ Restart “SQL Server” service as per the “Step 05”

recover-sa-password-08

Now you are all set to login into your SQL Server with the new SA password!

Prasad Sahoo

Prasad Sahoo, is an enthusiast of Microsoft technologies in general and a passionate database professional, mainly focusing on SQL Server performance tuning and business intelligence. He has contributed a long time of his career working on SQL Server and other RDBMS. If he is not busy with SQL stuff then he must be watching some Hollywood movies.

2 thoughts on “How to recover SQL Server SA password

Leave a Reply

%d bloggers like this: