Scenario: I’ve recently came across a user that had SQL on a server. The user was on the instance, but they had limited permissions. In essence this created a user that could login the SQL engine but had no access to the databases or the ability to add permissions to their account even though the account was a local administrator.
Here are the steps I took to elevate the user’s privileges:
- Start the instance in Single User Mode:
- Look at this article on How to Start SQL in Single User Mode.
EXEC master..sp_addsrvrolemember @loginame = N'test', @rolename = N'sysadmin'
It’s that simple
**I feel it is important to note that the user performing the SQLCMD query must be a local administrator.