Sometimes with SQL Server we need to login as a SQL Admin but we can't remember the password! Here we run through two methods how to reset that password in case of emergencies.
Content
00:00 Login failed for user 'sa'
00:28 Starting SQL in Single User Mode
01:08 Local Server Administrators
01:38 Reset sa Password
03:14 Reset SQL Admin Password Method 2
Login failed for user 'sa'
This is the most common error that you encounter when trying to login using your sa (sysadmin) account. 99% of the time this is caused due to the password being incorrect. You can get the exact reason from the error logs if you needed to.
Another common error which might occur if you are able to login is the 'Cannot alter login for user 'sa' because it does not exist or you do not have permission'.
If this is the case then again, follow the instructions below or naturally in the video.
How to Reset sa Password SQL Server
Ideally you would always have another SQL Login which has administrator rights to your SQL instance, generally this is a Windows account, but it can also be a SQL Account obviously! If this is the case then you'd login using this account and reset the sa password as shown in the tutorial - nice an easy! This is method 2 in the video.
If you are unfortunate and you don't have this, then you will need to login as a local administrator and reset (and potentially reenable the login). This is covered in method one of the tutorial.
Its a bit more thorough and little bit of a pain as it requires restarting SQL Server in Single User Mode and restarting SSMS or using SQLCMD to go over the necessary actions. A great link to this is covered on the SQL Shack website, I will provide the link below
https://www.sqlshack.com/recover-lost...
Can I reset the SQL Admin password on SQL Express?
This tutorial would work on all versions of SQL Server (Windows) including SQL Express, I'm excluding Linux here as it hasn't been tested on that but other versions then this method would be satisfactory
Useful Link
I feel another good link work mentioning would be the Wiki How link onw how to reset sa password in sql server
https://www.wikihow.com/Reset-SA-Pass...