Use sp_password to reset the sa password instance in SQL Server _mssql

Source: Internet
Author: User

SQL2000 sa password cannot be changed by resolution, the following error occurred in changing the sa password:

Copy Code code as follows:
Error 21776: [SQL-DMO] The name ' dbo ' is not found in the Users collection. If The name is a qualified name, use [] to separate various parts of the name, and try again.

WORKAROUND: Connect to SQL with the query manager with SQL and execute:

Copy Code code as follows:
EXEC sp_password NULL, ' XXXXXX ', ' sa '

Specific information about Sp_password is as follows:

Sp_password

Add or change Microsoft? SQL Server? The password for the login.

Grammar

sp_password [[@old =] ' Old_password ',]
{[@new =] ' New_password '}
[ , ] [@loginame =] ' Login ']

Parameters

[@old =] ' Old_password '
is the old password. Old_password is a sysname type with a default value of NULL.
[@new =] ' New_password '
is the new password. New_password is a sysname type with no default value. If you do not use named parameters, you must specify Old_password.
[@loginame =] ' Login '
is the login name that is affected by the password change. Login is a sysname type with a default value of NULL. Login must already exist and can only be specified by members of the sysadmin fixed server role.

Return code value

0 (Success) or 1 (failed)

Comments

The SQL Server password can contain 1 to 128 characters, which can include any letter, symbol, and number.
The new password is updated and stored in an encrypted form, so no user (even the system administrator) can view the password.

When members of the sysadmin or securityadmin fixed server role reset their own passwords with sp_password with all three parameters, the audit records reflect that they are changing someone else's password.

Sp_password not available for Microsoft Windows NT? Security account. Users connected 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.

Permissions

Execute permissions are granted to the public role by default to allow users to change their logon password. Only members of the sysadmin role can change the logon password of another user.

Example

A. Change the login password without the original password
The following example changes the password for the login Victoria to OK.

Copy Code code as follows:
EXEC sp_password NULL, ' OK ', ' Victoria '

B. Change Password
The following example changes the password for the login Victoria from OK to coffee.
Copy Code code as follows:
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.