Solution for SQL Server local Administrator account not logged in

Source: Internet
Author: User
Tags mixed

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.