Provide the best software to recover passwords for
Windows, SQL Server, PDF, Word, Excel, Outlook, FTP, Email, etc.
Home > SQL Server Password Changer > How to Reset SA Password from a Command Prompt

Reset SA Password from a Command Prompt

Forgot SQL Server password? How can I retrieve the SA password with not reinstalling SQL Server? There may be many more similar situations where employees who have the DB password leaves the job or a hacker disables the SA account.

The easiest way around this is to logon to the SQL Server NT machine itself as administrator, then follow this guide to reset your forgotten SA password.

Reset Forgotten SA Password

  1. Click Start, point to Run and type cmd, press Enter key.

  2. The command prompt will appear. Run the command:
    Osql –S john –E
    Replace john with your actual computer name.
  3. Then type this command to change your forgotten SA password.
    EXEC sp_password NULL, ’123456’, ’sa’
    Replace 123456 with the password you want.
  4. Type Go to make the change take effect.
  5. Now you are able to log into the SA account with your new password!

You can also use this method to change SQL Server passwords of other user accounts. If you're still unable to reset the SA password or SA account is locked out or disabled, please check out this article: 2 Methods to Unlock SQL Server SA Account When It's Locked Out.

Related Articles