简体   繁体   中英

SQL Server: How to change sa's Password?

I am currently using SQL Server Management Studio to update my sa password of my local database.

I went into the database and under security I Choose 'sa' and right clicked the 'Properties'. I then update the password and click on OK button to close the Properties window.

I disconnected the database and reconnected to it with username:sa and the changed password but I can't login to the database with sa

In order to change user's password you need to go to the Security node placed at the root of the object explorer. You do not need to go to the Security node, under your database's node.

Pinal has a post about changing the user's password. you can refer to it: https://blog.sqlauthority.com/2007/12/29/sql-server-change-password-of-sa-login-using-management-studio/

Make sure to restart the SQL Server and all its services and test new password by log into system using SA login and new password.

You can also change the password using following script:

USE [master]
GO
ALTER LOGIN [sa] 
      WITH CHECK_EXPIRATION=OFF, -- Password will never expired
           CHECK_POLICY=OFF      -- Password do not need to meet the password complexity policy
GO
USE [master]
GO
ALTER LOGIN [sa] WITH PASSWORD=N'123'
GO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM