How to connect to a SQL Server instance when you don't have the sa password

MicrosoftSQLServer

This is how you can get into a SQL Server instance if you have lost or don’t know the SA password.

Configure instance to start in maintenance mode
1. Open the SQL Server Configuration Manager tool from the “SQL Server 20xx| Configuration” menu
2. Stop the SQL Server Instance you need to recover
3. Navigate to the “Advanced” tab, and in the Properties text box add “;–m” to the end of the list in the “Startup parameters” option
4. Click the “OK” button and restart the SQL Server Instance

Connect to SQL Server instance
1. Open Command Prompt
2. SQLCMD -S <SERVERINSTANCE NAME>
* For local instances, enter <.INSTANCE NAME>

Change SA password
1>    sp_password @new = ‘<new password>’, @loginame = ‘sa’
2>    GO
1>    EXIT

Disable maintenance mode
1. Open the Configuration Manager tool from the “SQL Server 20xx| Configuration” menu
2. Stop the SQL Server Instance you need to recover
3. Navigate to the “Advanced” tab, and in the Properties text box and remove “;–m” to the end of the list in the “Startup parameters” option
4. Click the “OK” button and restart the SQL Server Instance

You should now be able to login through SQL Server Management Studio with the SA account and new password.

Thank Sri :)Thank Sri 🙂

Leave a comment