How can I add myself to my local sql server's windows authentication?
Solution 1:
Unfortunately I think you'll either have to:
- Get your local and beloved IT friend to log in to the database and set up your account correctly.
- Reinstall SQL Server under your account so that you are automatically granted log in permissions.
If you don't have access to the database, then you can't update the security to give yourself permissions.
In order to log in to your SQL Server (individual database permissions may still be missing) the security login needs to be created with Windows authentication
selected and then the domain account name is the Login name
.
Solution 2:
And also, since you are a local administrator.
follow microsoft step by step instructions: http://msdn.microsoft.com/en-us/library/dd207004.aspx or as below:
Stop the SQL Server Service.
Open a command prompt as administrator and browse to the SQL Server binn folder (C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Binn by default)
start the SQL Server in single user mode using the console output
sqlservr.exe -c -m
Then start SSMS or SQLCMD as admin, connect and run the following query:
CREATE LOGIN [DOMAIN\USER] FROM WINDOWS
GO
EXEC master..sp_addsrvrolemember @loginame = N'DOMAIN\USER', @rolename = N'sysadmin'
GO