How to Change the Password of a Login in SQL Server

To change the password of a login in SQL Server use the following command (it requires ALTER ANY USER permission, and also CONTROL SERVER permission to change a password for a login that has CONTROL SERVER permission):

ALTER LOGIN [login_name] WITH PASSWORD = 'NewStrongPassword';
GO

change_password_login_sql_server

To change the password of a login using SQL Server Management Studio (SSMS):
Right click on a login, click ‘Properties’, and enter the new password in the 'Password' and 'Confirm Password' box, and click 'OK':

change_password_login_sql_server_ssms

If a login that doesn't have ALTER ANY USER permission wants to change it's own password, OLD_PASSWORD parameter is required:

ALTER LOGIN [login_name]
WITH PASSWORD = 'NewStrongPassword'
OLD_PASSWORD = 'OldPassword';
GO

password_change_with_supplying_old_password

Without supplying the OLD_PASSWORD parameter, or if incorrect OLD_PASSWORD is entered, user will get the following error:

Msg 15151, Level 16, State 1, Line 1
Cannot alter the login 'login_name', because it does not exist or you do not have permission.

password_change_without_supplying_old_password

If the post helped you, please share it:
Pin It

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">