Wednesday 21 June 2017

How Reset SA password in MSSQL Server


Step 1: Stop the sqlserver services using sql server configuration manager

                                         

Step 2: Select the sql server and click the properties and select the advanced tab

                               

Step 3: Change the startup parameter in sql server properties. Add the -m value in front of
            existing values.

                                               

Step 4: Start the sqlserver services. Now sql server running single user mode 

Step 5: Start the CMD prompt and enter the 'sqlcmd' command

Step 6: Create a New user in mssql, Enter the following commands.

           CREATE LOGIN username WITH PASSWORD = 'password'
           GO
           sp_addsrvrolemember 'username','SYSADMIN'
           GO

Step 7: Stop the sqlserver service again for change the startup parameter values
    (remove the -m values in startup parameter)

Step 8: Start the sql services again using created login

Step 9: Now go to security option and change the SA user values in sql server

Step 10: Now use the sa user.