How can I forget the SA User Password of SQL Server?

Source: Internet
Author: User
How can I forget the SA User Password of SQL Server?

Ms SQL Server is installed on both the desktop and the current version to facilitate testing.
After a long time, the password of the desktop SQL Server was forgotten ......
Don't you ...... No way? -- No!
After a while, you found the method in Baidu:
Of course, your Enterprise Manager cannot enter, but we still have a query analyzer.
During authentication, you choose to follow the Windows authentication, and then go directly ...... Khan!
Run the following command:
Exec sp_password null, 'new password', 'sa'
Now the password has changed. Go to the Enterprise Manager and check ^_^.
The following is a description of the sp_password stored in the SQL Server:
Sp_password
Add or change the password for Microsoft SQL Server logon.
Syntax
Sp_password [[@ old =] 'old _ password',]
{[@ New =] 'new _ password '}
[, [@ Loginame =] 'login']
Parameters
[@ Old =] 'old _ password'
Is the old password. Old_password is of the sysname type, and its default value is null.
[@ New =] 'new _ password'
Is the new password. New_password is of the sysname type and has no default value. If the name parameter is not used, you must specify old_password.
[@ Loginame =] 'login'
Is the login name affected by the password change. Login is of the sysname type, and its default value is null. Login must already exist and can only be specified by members of the SysAdmin fixed server role.
Return code value
0 (successful) or 1 (failed)
Note
The SQL Server password can contain 1 to 128 characters, including any letters, symbols, and numbers.
The new password is updated and stored in encrypted form. Therefore, no user (or even System Administrator) can view the password.
When members of SysAdmin or securityadmin fixed server roles use sp_password with all three parameters to reset their own passwords, the review records reflect that they are changing others' passwords.
Sp_password cannot be used for Microsoft Windows NT Security Accounts. Users who connect to SQL Server through a Windows NT network account are authorized by Windows NT, so their passwords can only be changed in Windows NT.
Sp_password cannot be executed in a user-defined transaction.
Permission
By default, the execution permission is granted to the public role for users to change their logon passwords. Only members of the SysAdmin role can change the logon password of other users.
Example
A. Change the logon password without the original password
The following example changes the password for logging on to Victoria to OK.
Exec sp_password null, 'OK', 'victoria'
B. Change the password
In the following example, the password for logging on to Victoria is changed from OK to coffee.
Exec sp_password 'OK', 'coffee'

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.