Reset SA Password Using sqlcmd

Resetting the SA password

If you need access to the database, you can reset the SA password using the following commands from a command prompt (cmd):

sqlcmd –S SQLSERVER\INSTANCE

Once in the interface for sqlcmd, which is represented by a 1>, type the following on separate lines:

sp_password @new = ’newpassword’, @loginame = ‘sa’
go
exit

Just so you know, the @loginame procedure does have only one “n”.
Unlocking the SA user

If you have tried to access the database too many times with the wrong password, the SA account may be locked out. Do the following to unlock the account from a command prompt (cmd):

sqlcmd –S SQLSERVER\INSTANCE

Once in the interface for sqlcmd, which is represented by a 1>, type the following on separate lines:

ALTER LOGIN sa WITH PASSWORD = ‘newpassword’ UNLOCK
go
exit

Full Article HERE.

Author: Matt

1 thought on “Reset SA Password Using sqlcmd

Leave a Reply