Created
September 10, 2013 18:28
-
-
Save gscattolin/6513495 to your computer and use it in GitHub Desktop.
Access to SQL and add admin rights
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shut down SQL Server from services | |
| open cmd window (as admin) and run single-user mode as local admin with this command | |
| c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn\sqlservr.exe" -m -s SQLEXPRESS | |
| open another cmd window (as admin) | |
| open sqlcmd | |
| sqlcmd -S .\SQLEXPRESS | |
| Now add the sysadmin user: | |
| sp_addsrvrolemember 'domain\user', 'sysadmin' | |
| GO | |
| Ctrl+C the single-user mode from the first cmd window to kill SQL Server. | |
| Restart it from services the normal way. | |
| Log into Management Studio and the user you created should be listed under logins with the credential of "sysadmin." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment