I am using SQL server 2008 on windows 7 Machine and when i tr开发者_如何学运维y to logon using local user i get error message login failed cannont login, i am administrator on my machine. Any Ideas?
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.
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.
精彩评论