SQL Server add sysadmin role: Difference between revisions

From WickyWiki
Created page with "Category:Windows Category:Windows SQL Server Category:201903 SQL Server add sysadmin role <! Administrator Permissions Denied --> Source: * https://serverfault...."
 
mNo edit summary
Line 5: Line 5:
SQL Server add sysadmin role
SQL Server add sysadmin role


<! Administrator Permissions Denied -->
<!-- Administrator Permissions Denied -->


Source:
Source:

Revision as of 15:35, 20 March 2019


SQL Server add sysadmin role


Source:

Shut down SQL Server from services

net stop MSSQL$SQLEXPRESS

Open cmd-window (as admin) and run single-user mode as local admin with this command

"C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\Binn\sqlservr.exe" -m -s SQLEXPRESS

Other cmd-window (as admin):

sqlcmd -S .\SQLEXPRESS

Add your user to the 'sysadmin' group:

 sp_addsrvrolemember 'DOMAIN\user1', 'sysadmin'
 GO
 quit

Ctrl+C the single-user mode from the first cmd window to kill SQL Server.

Start services:

net start MSSQL$SQLEXPRESS

Log into Management Studio and the user you created should be listed under logins with the credential of "sysadmin."