SQLServer database SA user password is changed, unavailable solutions

xiaoxiao2021-03-05  25

1. Log in to "Query Analyzer" as Windows Authentication: 2. Run the stored procedure to modify the "SA" account password

SP_Password Null, 'OK', 'SA' After running, the password becomes "OK"

The following is an explanation in SQL Server Help:

SP_Password

Add or change the password of the Microsoft® SQL ServerTM login.

grammar

SP_Password [[@old =] '{[@new =]' new_password '} [, [@loginame =]' login ']

parameter

[@OLD =] 'Old_password'

Is the old password. Old_password is a sysname type, its default value is NULL.

[@new =] 'new_password'

It is a new password. New_password is the sysname type, no default value. If you do not use a named parameter, you must specify Old_Password.

[@loginame =] 'login'

It is the login name affected by the password change. Login is a sysname type, its default value is NULL. Login must already exist and can only be specified by members of the SYSADMIN fixed server role.

Returns the code value

0 (success) or 1 (failed)

Comment

The SQL Server password can contain 1 to 128 characters, which can include any letters, symbols, and numbers.

The new password is updated and stored in encrypted form, so any user (even system administrator) cannot view the password.

When a member of the Sysadmin or SecurityAdmin fixed server role uses sp_password with all three parameters to reset their own password, the audit record reflects that they are changing the passwords of others.

SP_Password cannot be used for Microsoft Windows NT® security accounts. The user connected to SQL Server via the Windows NT network account is authorized by Windows NT, so its password can only be changed in Windows NT.

SP_Password cannot be executed in user-defined transactions.

Authority

Perform permissions The public role is granted by default for users to change their login password. Only members of the SYSADMIN role can change the login password for other users.

Example

A. Change the login password without original password

The following example will change the password of Victoria to OK.

EXEC SP_Password Null, 'OK', 'Victoria'

B. Change your password

The following example will change the password of Victoria by OK to Coffee.

EXEC SP_Password 'OK', 'Coffee'

转载请注明原文地址:https://www.9cbs.com/read-34816.html

New Post(0)