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 SQL Server Password in Single-user Mode

How to Reset SQL Server Password in Single-user Mode

Forgot your SA password and can't connect to SQL Server? How to login to SA account after locked out of SQL Server? Luckily there is a backdoor in SQL Server that will help you gain sysadmin access to your SQL Server instance. Just start SQL Server in single-user mode and you can then create a new SQL account with sysadmin role. This hacking trick makes it possible to unlock SQL Server login without resetting the password of any existing account.

Reset SQL Server Password in Single-user Mode

  1. Launch SQL Server Configuration Manager. Stop your SQL Server instance if it is running.
  2. Right-click on your SQL Server instance and select Properties.

    SQL Server Configuration Manager

  3. In SQL Server 2014 or 2012, click Startup Parameters tab. Enter –m and then click Add.

    SQL Server 2014/2012 Startup Parameters

    If you've installed SQL Server 2008 (R2) or an earlier version, click Advanced tab and add -m; before existing value in Startup Parameters box, without any spaces.

    SQL Server 2008/2005 Startup Parameters

  4. Save your changes and restart the SQL Server instance. This will start SQL Server in single-user mode.
  5. Open an elevated Command Prompt and use the SQLCMD command to connect to your SQL Server instance:
    SQLCMD –S .\SQLEXPRESS
    Replace SQLEXPRESS with the name of your SQL Server instance.
  6. Here we'll create a new login called "tom" and then add this account to the SA server role. Run this command:

    CREATE LOGIN tom WITH PASSWORD='P@ssword123'
    GO
    SP_ADDSRVROLEMEMBER tom,'SYSADMIN'
    GO

    Create New Login in SQL Server Single-user Mode

    For SQL Server 2012/2014 or newer, ALTER SERVER ROLE should be used instead of SP_ADDSRVROLEMEMBER as this system stored procedure will be removed in a future version of Microsoft SQL Server.

    CREATE LOGIN tom WITH PASSWORD='P@ssword123'
    GO
    ALTER SERVER ROLE sysadmin ADD MEMBER tom
    GO

  7. Once you've successfully performed these steps, the next step is to stop your SQL Server instance. Remove the -m you've added in Startup Parameters.
  8. Start your SQL Server instance. Open the SQL Server Management Studio and you can login using the newly created "tom" account. You now have SA access to your SQL Server instance. You may now reset the SA password and take control of your SQL Server box.

However, if you can't access SQL Server in single-user mode or can't log on Windows as administrator, this method won't work. In that situation, you need to use the SQL Server Password Changer program which enables you to unlock / reset SQL Server SA password offline.




Related Articles