Saturday, February 6, 2010

Forget password of sa account

My Friend asks me about what we can do if we forgot sa password, so what the solutions can solve our problems?


Solution 1:

If you have windows login account which is member of admin group (Builtin\Administrator) because members of this users by default belong to sysadmin privilege so login by this user to windows and then login to sql server management studio with using windows authentication and then reset sa account password.

Note: here you need to start sql server in Single user mode and you can do it by this command:

Stop the sql server service:

net stop ServiceName


You can find you service name as picture below:

 
 
 
 
 
 
 
 
 
Start the service in single user mode:

net start ServiceName \m


Solution 2:

If you have Sql server user login which is member of sysadmin so login by this user to sql server management studio with sql server authentication and then reset sa account password.

Solution 3:

Using third party like "MS SQL SERVER PASSWORD UNLOCKER"

Last solution:

Last killing option is to Uninstall and reinstall sql server.


Best Practices:

• Always do not use sa account to connect through your application to sql server because first of all it's a hackers favorite

• Create a group in windows and then add this group to sql server and grant this group a sysadmin privileges so any time you can add any user to this group then login as sysadmin to Sql server.


Note: the above solutions can also solve of situation of disabled sa account.

No comments: