Even experienced IT professionals sometimes lose access to their systems. If you cannot log in to SQL Server 2019 because you forgot the administrator password, do not worry. There are secure ways to reset it without losing any data. This post explains how to recover access to your instance.
1. Use Windows Authentication
If your SQL Server is configured in mixed mode (Windows and SQL Server authentication), and you have local administrator rights on the machine, this is the quickest option.
Steps:
- Open SQL Server Management Studio (SSMS)
- Log in using Windows Authentication
- Run the following command to reset the
sapassword:
ALTER LOGIN sa WITH PASSWORD = 'NewStrongPassword';
Choose a strong password with uppercase letters, lowercase letters, numbers, and symbols.
2. Start SQL Server in Single-User Mode
If Windows Authentication is not available, you can restart SQL Server in Single-User Mode and connect using your local Windows admin account.
Steps:
- Stop the SQL Server service using
services.msc - Open Command Prompt as Administrator
- Start SQL Server in single-user mode:
net start MSSQLSERVER /m
(If your instance name is different, replace MSSQLSERVER with the correct name.)
- Connect using SSMS or
sqlcmdwith Windows Authentication - Reset the
sapassword:
ALTER LOGIN sa WITH PASSWORD = 'NewStrongPassword';
GO
- Restart the SQL Server service in normal mode
3. Use SQLCMD from the Command Line
If SSMS is not available, you can use the sqlcmd utility to reset the password.
sqlcmd -S . -E
Then enter:
ALTER LOGIN sa WITH PASSWORD = 'NewStrongPassword';
GO
Important: Prevent Future Lockouts
To reduce the risk of losing access again:
- Store admin passwords securely in a password manager like KeePass or Bitwarden
- Enable Windows Authentication as a backup login method
- Consider creating multiple admin-level accounts with strong passwords
Author: Michel Rongen
Specialization: SQL Server | LIMS | Technical Consultant
Website: www.limsconsult.nl

No responses yet