These days in the course of the SQL Server 2008, the first day of today, because the organizers prepared the environment is to use the same virtual machine, and then distributed to many experimental machines, with Sysprepare This tool, modified the computer name. A long time ago, you could not log on to SQL Server, either with a local administrator or an SA account.
1. First logon from Windows Authentication mode
2. Right-click on "Server" and select "Properties"
3. Find "Security" on the left, with a Windows identity login, a SQL Server and Windows authentication, and a second.
4. Restart SQL Server services. (or right click on "Server", is the root node, select Reboot Server
I analyzed that the reason the local administrator was unable to log in was because after the computer name had been modified, the current local administrator's SID was not the SID of the local administrator who changed it, and SQL Server actually kept the SID, not the user name, so that he could not log on to the server. And as for the SA account can not log in, because the organizers in the preparation of the environment, does not enable the mixed authentication mode.
The approximate steps are:
Log on with a local administrator, stop the SQL Server service
Modify the startup parameters of the SQL Server service, and add "; M" (without double quotes) after the original startup parameter, which is to set SQL Server into Single-user mode
Start SQL Server service, use SQLCMD to log on to the SQL Server server
Execute exec sp_addsvrrolemember ' machinenameadministrator ' sysadmin '; Go; (Note that the red part is to be replaced by your local Administrator account)
Stop the SQL Server service and remove the startup parameters that were previously added;-M
to start the SQL Server service
recommend that you install SQL Server. or set up mixed authentication mode and SA password, and then protect this password.