Uncategorized

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 sa password:
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:

  1. Stop the SQL Server service using services.msc
  2. Open Command Prompt as Administrator
  3. Start SQL Server in single-user mode:
net start MSSQLSERVER /m

(If your instance name is different, replace MSSQLSERVER with the correct name.)

  1. Connect using SSMS or sqlcmd with Windows Authentication
  2. Reset the sa password:
ALTER LOGIN sa WITH PASSWORD = 'NewStrongPassword';
GO
  1. 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

Tags:

No responses yet

Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *