Can't login to SQL Server with Windows Authentication? Have you
accidentally removed the built-in administrator account from SQL Server
logins? Does the Windows account become locked and unusable for further
use? Don't worry! In this article we'll show you how to enable mixed
mode authentication in case your SQL Server is configured for Windows
Authentication only, and then enable / reset your SA password easily!
Part 1: Enable Mixed Mode Authentication
If you can connect to SQL Server with SQL Server Management Studio, you can easily switch to mixed mode with just a few mouse clicks! However, what to do if you're locked out of every SQL Server account and can't login even with Windows Authentication? Here is a simple registry trick:
Even if the authentication mode is switched to SQL Server mixed mode after the installation, the SA account is still disabled and must be manually enabled. With SQL Server Password Changer you can offline enable / unlock your SA account in case your SA account is disabled, locked out or you simply forgot the password. Here are steps:
Part 1: Enable Mixed Mode Authentication
If you can connect to SQL Server with SQL Server Management Studio, you can easily switch to mixed mode with just a few mouse clicks! However, what to do if you're locked out of every SQL Server account and can't login even with Windows Authentication? Here is a simple registry trick:
- Press the Windows key + R to bring up the Run box. Type
regedit
and press Enter. - Navigate to the registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQLServer, where MSSQL10.SQLEXPRESS is the name of your SQL Server instance.
- In the right panel, change the LoginMode from 1 to 2. (1 = Windows authentication Only. 2 = Mixed mode.)
- Restart your SQL Server instance for this change to take effect.
Even if the authentication mode is switched to SQL Server mixed mode after the installation, the SA account is still disabled and must be manually enabled. With SQL Server Password Changer you can offline enable / unlock your SA account in case your SA account is disabled, locked out or you simply forgot the password. Here are steps:
- First of all, you need to stop your SQL Server service so the password recovery software can access the master.mdf database offline.
- Download the SQL Server Password Changer on your computer. After you've downloaded it, double-click the setup file to install it.
- Start SQL Server Password Changer. Click on Open File button and select the master.mdf database for your SQL Server instance. In my example, the master.mdf file is located in C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA.
- The program will extract all the SQL Server logins from the master.mdf database. Choose the SA account and click on Change Password button. Set a new password in the popup window and click OK.
- Now you've successfully enabled / unlocked the SA account. Start your SQL Server service and you can now login to the SA account with your new password! It's that easy!