How can I add myself to my local sql server's windows authentication?
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
Since you are a local adminstrator you can use the backdoor to SQL Server instance to obtain access.
Download psexec.exe (PSTools from TechNet here).
Go to a command prompt and to the directory where you extracted the file (psexec.exe). Run the command psexec.exe -i -s ssms.exe
or psexec.exe -i -s sqlwb.exe
for SQL 2005.
This is going to open SSMS as the NT AUTHORITY\SYSTEM account, which by default is given SYSADMIN rights to the instance. You should then be able to add your login to the instance. If this does not work it is likely the system account permission was removed.
NOTE: If you are on Vista or Windows 7 you will probably need to run the command prompt as Administrator (right-click "run as Administrator").
Second Note: This will not work on SQL Server 2012 or above because the built-in administrator group is no longer added as sys admin by default. The exception to this could be if you are eating with an in-place upgrade.
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
.