How to Change Password in SQL Server 2012

Here, we will see how to change the password visually and programmatically in SQL Server 2012. This is a common problem which is frequently asked in many sites. Many people forget their password shortly after installing Microsoft SQL Server or they have not used SQL Server after a long time. You can change the password and once again access your account using Windows Authentication mode. So let's have a look at a practical example. The example is developed in SQL Server 2012 using the SQL Server Management Studio.
 

SQL Server Change Password Visually

 
To change the SQL Server password for the sa login just do the following.
 
Open SQL Server 2012, and select the authentication mode and Login using Windows Authentication.
 
Window-authentication-mode-in-SQLServer.jpg
 
Now click on the connect Button and you will be taken to the SQL Server Management Studio.
 
In SQL Server Management Studio, Press F8 to open the Object Browser in SQL Server Management Studio and expand it. Object Explorer -> Security -> Login -> select sa
 
Object-explorer-in-SQLServer.jpg
 
Now right-click on the sa and select property.
 
login-sa-propertyr-in-SQLServer.jpg
 
Now click on the property and the login property window will be opened.
 
login-property-window-in-SQLServer.jpg
 
Now change the password and confirm it. Press OK Button.
 

SQL Server Change Password Programmatically

  1. Open the SQL Server Management Studio.
  2. Click new query to open a New Query.
  3. Paste and execute the following code.
  1. USE [master]  
  2. GO  
  3. ALTER LOGIN [sa] WITH PASSWORD=N'New Password', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF  
  4. GO  
Now Press F5 to execute the query.
 
change-password-programmatically-in-SQLServer.jpg 


Similar Articles