views:

153

answers:

2

I am using SQL server 2008 on windows 7 Machine and when i try to logon using local user i get error message login failed cannont login, i am administrator on my machine. Any Ideas?

A: 

NT Administrators are not granted login priviledge to SQL Server. You need to ask a SQL Server administrator to grant you the priviledge to log into the SQL Server.

Updated

If you locked yourself out of your own instance, see Troubleshooting: Connecting to SQL Server When System Administrators Are Locked Out.

Remus Rusanu
I am on network, but I installed SQL server locally on my machine, and I cannot log in locally i am not trying to logon on SQL via network
WingMan20-10
A: 

It depends somewhat on how you set up SQL server during the install. If you enabled Windows Authentication (usually on by default), then you will be able to log on using the windows account that you installed SQL server under. If not, you will need to use an SQL server login (not a Windows login) to log in. Probably you have a windows authentication login for the windows account in which you installed SQL Server, so you'll need to reboot into that account to manage your SQL server.

Once you have logged in as an administrator in SQL Server Management Studio you can then edit the logins (under Security\Logins) for the server to grant the permissions you require to the user account you wish to use. To grant rights to a different windows login, you will have to create a new SQL user for that login name (as pc-name\user-name, e.g. MYPC\UserName), leave it set to Windows Authentication, and then in the Server Roles section, enable the relevant permissions, e.g. sysadmin

Then you should be able to log back in as that windows user and log in to the SQL server.

Jason Williams
I enabled windowns authentication when I installed SQL 2008
WingMan20-10
How do i login to SQL as an administrator
WingMan20-10
If you enabled windows authentication during the install, then the Windows User you installed it with has administrative rights. Log in to your PC as that user then run SQL Server Management Studio Express (install the SQL Server Tools if you can't find it in your start menu) and it'll log you straight in (it will show all the correct options by default and you just click ok on the login dialog)
Jason Williams