Quick Answer
SQL Server stores passwords as hashes, so you usually reset a lost password rather than read it. Sign in with Windows Authentication (or another sysadmin) and reset the login in SSMS, or start SQL Server in single-user mode and run ALTER LOGIN. If both fail, the SoftMagnat SQL Password Recovery Tool can recover the password from the MDF file. The free trial shows only the first two characters.
Locked out of SQL Server? You are not alone. Example: a small company’s only database administrator leaves, nobody knows the sa password, and the accounting database can no longer be managed. This guide shows how to recover or reset a lost SQL password manually, from the simplest method to the most technical, and what to do when they fail.
sa (system administrator) password was forgotten or never handed over.sa was disabled or locked after repeated wrong attempts under the password policy.master database files before making changes.sa cannot connect, even after a reset. Switch to Mixed Mode in Server Properties > Security.The steps below apply to SQL Server 2012 through SQL Server 2025. Note that SQL Server 2016 left extended support on July 14, 2026, so consider upgrading.
Any member of the sysadmin role can reset your password in seconds. Check whether a colleague, an IT partner or a Windows domain admin group still has access before trying anything technical.
This works if your Windows account is already a sysadmin. Example: you are logged in as the domain admin who installed SQL Server, but nobody remembers the sa password. A reset takes about two minutes.
sa (or the affected login) and choose Properties.You can do the same in a query window:
ALTER LOGIN sa WITH PASSWORD = 'YourN3w!StrongPassword';
ALTER LOGIN sa ENABLE;
If no sysadmin account is available, you can still get in as a local Windows administrator on the server. Microsoft documents this as the way to regain access when system administrators are locked out. It needs a short outage, because the service restarts.
net stop MSSQLSERVER
net start MSSQLSERVER /mSQLCMD
sqlcmd -S . -E
1> prompt, run:ALTER LOGIN sa WITH PASSWORD = 'YourN3w!StrongPassword';
ALTER LOGIN sa ENABLE;
GO
EXIT
net stop MSSQLSERVER
net start MSSQLSERVER
Tips: type SQLCMD in capital letters. For a named instance, use MSSQL$InstanceName and sqlcmd -S .\InstanceName -E. To give your own Windows account access instead, run CREATE LOGIN [DOMAIN\YourName] FROM WINDOWS; and then ALTER SERVER ROLE sysadmin ADD MEMBER [DOMAIN\YourName];.
Manual methods need a working SQL Server service and local admin rights. They are risky for non-experts. Example: the server will not start in single-user mode, or all you have is a copy of the master.mdf file after a migration. A dedicated tool is easier here.
The SoftMagnat SQL Password Recovery Tool works like this:
It also recovers multilingual passwords from MDF files, and it lets you change the recovered password. The free trial is almost the same as the full version, but shows only the first two characters of the password.
If your real problem is a damaged database rather than a lost password, see SoftMagnat SQL Database Recovery or SQL Server Recovery Manager.
sa password in a company password manager.sa disabled and use named admin accounts.Usually you reset it instead, because SQL Server stores passwords as hashes. Sign in as another sysadmin, use Windows Authentication, or use single-user mode. If those fail, SoftMagnat SQL Password Recovery Tool can recover SQL passwords from the MDF file.
Log in to the server as a local Windows administrator, stop SQL Server Agent, and start SQL Server in single-user mode with the /mSQLCMD option. Connect with sqlcmd and run ALTER LOGIN sa WITH PASSWORD, then restart the service normally.
Yes. Windows Authentication, SSMS login properties and single-user mode with ALTER LOGIN apply to SQL Server 2012 through 2025. Menu layouts differ slightly between SSMS versions.
You select the MDF file, choose the user whose password you want to recover, and click recover. The recovered password is then listed in the results. No command-line knowledge is needed.
Yes. It can recover multilingual passwords from MDF files in a single run, and it also lets you change the recovered password.
Yes. The trial works almost like the full version but displays only the first two characters of the recovered password. Buy the full version to see the complete password.
The tool recovers passwords from Microsoft SQL Server 2000 database files. If you use a newer version such as SQL Server 2019 or 2022, download the free trial and test it on a copy of your master.mdf file first.
Yes, if you own the server or are authorized by its owner. Never use password recovery methods or tools on systems you do not have permission to manage.
As a Technical Writer at SoftMagnat Software, I craft precise and straightforward documentation for software users. My goal is to break down technical information into clear, simple content, ensuring users can easily understand and use the products. I focus on creating effective manuals, guides, and tutorials that enhance the overall user experience.