In this article, we will show you how to connect to SQL Server when all system administrators are locked out.
First, you will need to login to the server using an account that has administrative privileges. Then, you will need to open up the SQL Server Configuration Manager. Once you have opened up the Configuration Manager, click on theSQL Server Services option. Right-click on the SQL Server service and select the Stop option. Now, you will need to open up the Registry Editor. To do this, go to Start > Run and type in “regedit”. Once you have opened up the Registry Editor, navigate to the following location:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLServer\Parameters
At this location, you will need to create a new String Value and name it “LoginMode”. Once you have created the LoginMode value, double-click on it and set the Value data to 1. After you have made these changes, close the Registry Editor and restart the SQL Server service. Now, you should be able to login to SQL Server using the sa account.
In this article, we will discuss how to connect to SQL Server when all system administrators are locked out.
We will go through the steps necessary to gain access to the server and reset the passwords for the system administrator accounts.
1) Connect to the server via RDP (Remote Desktop Protocol). If you do not have RDP access, you will need to contact your hosting provider or server administrator to gain access.
2) Once connected, open up the Services console (services.msc).
3) Find the SQL Server service and stop it.
4) Once stopped, open up regedit (regedit.exe). Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLSERVER.
5) Find the ImagePath value and double-click it.
6) In the Value data field, change the value to: “C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Binn\sqlservr.exe” -m -sSQL
7) Click OK and then close regedit.
8) Now open up a command prompt (cmd.exe) and navigate to C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Binn.
9) Run the following command: sqlservr.exe -m -sSQL
10) The SQL Server service should now be running in single-user mode. You can now connect to the server using the SQLCMD utility or SQL Server Management Studio.
11) Once connected, you can reset the passwords for the system administrator accounts. For more information on how to do this, see the following article: How to Reset SQL Server Sysadmin Password
12) Once the passwords have been reset, you can stop the SQL Server service and start it up normally. You should now be able to connect to the server using the system administrator accounts.
13) If you are still having issues connecting to the server, make sure that the firewall is not blocking access to the SQL Server port (default is 1433). You will also need to make sure that the SQL Server service is set to start automatically.
14) You should now be able to connect to SQL Server when all system administrators are locked out.
FAQs:
How do I connect to SQL Server if I am locked out?
If you are locked out of SQL Server, you will need to gain access to the server and then stop the SQL Server service. Once the service is stopped, you can start it up in single-user mode and connect to the server using the SQLCMD utility or SQL Server Management Studio. From there, you can reset the passwords for the system administrator accounts.
How do I set SQL Server to start automatically?
To set SQL Server to start automatically, you will need to open up the Services console (services.msc) and find the SQL Server service. Right-click on the service and select the Properties option. In the Properties window, change the Startup type to Automatic and click OK.
How do I open the SQL Server port in the firewall?
To open the SQL Server port in the firewall, you will need to add an inbound rule. To do this, open up the Windows Firewall console (wf.msc) and click on the Inbound Rules node.
Conclusion:
In this article, we discussed how to connect to SQL Server when all system administrators are locked out. We went through the steps necessary to gain access to the server and reset the passwords for the system administrator accounts.