Forget the SQL Server account SA Password

Source: Internet
Author: User

Simply forget the password, or keep it disabled, and then want to re-enable it:

The test environment is SQL Server 2008, but both 05 and R2 can be used.
1. Available

 
Sp_passwordNull,'123','SA'--Set sa password to "123"

2. You can also enable it and then change the password.

  alter  login SA enable  --   enable SA   go   alter  login  [  SA  ]   with  password = n  '  newpassword   '  --   no old password is required.  

Note: Check the attribute ---> Security ---> server authentication when changing the settings. Is this 'SQL Server and Windows Authentication mode'
Otherwise, the following situation may occur:
Login Failed for user 'sa '. Cause: an attempt to use SQL authentication fails. The server is configured to use Windows authentication only. [Client: <Local Machine>]
Error: 18456, severity: 14, status: 58.

In this case, you need to change the body Verification Mode to 'SQL Server and Windows Authentication mode', restart the service, and then change the password to log on.

If you are not sure whether the registry is modified, check the registry information:HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ MSSQLServer

Check whether the value of "loginmode" is "1" or "2. 1" indicates windows body verification, and "2" indicates SQL Server and Windows identity authentication.

:

The following are the errorsStatusLink of Information Description:
Http://msdn.microsoft.com/zh-cn/library/cc645917.aspx

 

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.