How reset the ‘sa’ password of SQL Server:

Plan A - If you have an account in sysadmin role then you can use SSMS or T-SQL:

1
2GO
3ALTER LOGIN [sa] WITH DEFAULT_DATABASE=[master]
4GO
5USE [master]
6GO
7ALTER LOGIN [sa] WITH PASSWORD=N'Pass1word$'
8GO

Plan B- If you do not have an account in sysadmin role, but you are local administrator.

  1. Restart SQL Server in single-user mode;
  2. Open ‘sqlcmd’ and add yourself in the sysadmin role;
  3. Undo step 1;

That’s all pretty easy.

Step 1 : Restart SQL Server in single-user mode

Step 2: Open ‘sqlcmd’ and add yourself in the sysadmin role;

Or you can just execute this code to add yourself:

1
2DECLARE @s AS NVARCHAR(200); SET @s='sp_addsrvrolemember '''+ SYSTEM_USER+''', ''sysadmin'';'; EXEC(@s);
3GO
4quit

Step 3: Undo step 1

Remove parameter ‘-m’ and restart SQL Server