Thursday, November 21, 2024
Microsoft SQL Server

How to start SQL Server in Single user mode

Detailed steps to start a SQL Server instance in Single User mode. Also how to connect to the single user mode sql server instance using SQLCMD.

  1. Open SQL Server Configuration manager from your start menu
SQL Server configuration manager window

2. You can see the names of the SQL Server services. In this case I need to start the 1st instance and the name of the instance is, as highlighted SQL Server (SQL2K19). We have to remember this name, this is what we need to start/stop a SQL Server service. We will use this service name in step 4

3. Now open a Command Prompt in administrator mode

Starting Command Prompt in administrator mode

4. Run the following command to stop SQL Server first. Note that we have to mention the service name in double quotes (“”). Make sure to update the command with your SQL Server Instance name inside double quotes.

net stop "SQL Server (SQL2K19)" 
SQL Server stopped using net stop command

5. Now that SQL Server is stopped, we can start it in Single User mode using the following command. Make sure to update the command with your SQL Server Instance name inside double quotes.

net start "SQL Server (SQL2K19)" /mSQLCMD
SQL Server started using net start command and /mSQLCMD switch

6. SQL Server is now started in Single User mode. Note that I have mentioned /mSQLCMD. By explicitly mentioning SQLCMD with /m switch, only sqlcmd application can connect to SQL Server. This way we can avoid other applications from utilizing the only connection available in Single User mode. We can now connect to the SQL Server instance using sqlcmd using the below command. Remember to update the script and put your SQL Server instance name for -S switch inside the double quotes.

sqlcmd -S ".\SQL2K19" -E
Connected to the SQL Server instance which is in single user mode, with out even entering credentials.

7. We are now connected to the SQL Server instance, with out even entering credentials.

One thought on “How to start SQL Server in Single user mode

Comments are closed.

Back To Top
error: Content is protected !!