Sunday, December 22, 2024
Microsoft SQL Server

Connect to SQL Server with out a password

Steps to connect to your SQL Server and reset the sa password with out having permissions. You can recover your sa password, or this can be used to connect to any sql server instance your ex DBAs left you with out providing you the necessary permissions or credentials.

  1. First you have to shutdown your SQL Server Instance. And start it in Single user mode. Please follow the below link from itech-blog.com to achieve this.

2. Once the SQL Server instance is started in single user mode and you are connected to the instance using SQLCMD, follow the below commands to reset your sa password. [Replace the password with a strong password]. Also remember to update the script and put your SQL Server instance name for -S switch inside the double quotes.

sqlcmd -S ".\SQL2K19" -E
alter login sa with password = 'YourPassword@123'  
connect to sql server instance using sqlcmd and reset the sa password using alter login command

3. SQL Server sa password is now reset. You can now stop the SQL Server instance, and start it in normal mode, that is., in multi-user mode using the below commands. Remember to update the script and put your SQL Server instance name inside the double quotes.

net stop "SQL Server (SQL2K19)" 
net start "SQL Server (SQL2K19)"
Stopping and starting sql server in multi-user mode

4. SQL Server Instance sa password is now reset. You can now use this password and connect to your SQL Server Instance.

Back To Top
error: Content is protected !!