We’ve all heard of the SA which is short for “System Administrator”. If we forgot the password for this user SA, we will get the SA account locked out and fail to log onto SQL when Windows authentication mode is not allowed. This can be a very serious problem! However, the problem is: in order to unlock the SA account when we forgot SA password, what should recover sa password? Should we have to reinstall SQL?
Obviously, SQL Server reinstallation would cause serious data loss or corruption to the databases. If you need to reinstall SQL just because of SA password forgotten or SA account locked, then it is not necessary for you to do that at all since we can figure out other better ways to fix the problem.
Way1: Use another admin account which is a member of Windows admin group or connect via Windows authentication.

For unlocking SA, one feasible way is that you have to connect as a machine administrator to the Server, as you observed. The machine administrators are by default granted access to SQL Server. Once you connect as an administrator, you can issue:
(Note: This way only works when you are still allowed to log on with Windows authentication mode on the local Windows computer of Server.)
Way 2: Use a professional SA Password Recovery program.

If you fail to recover SA password with the above, probably this way—using a professional SA Password Recovery program would be your last resort. And undoubtedly selecting a credible software program while you are unlocking SA password cannot be more important. Here I recommend SA Password Recovery for you. It is a professional and well-known program designed for safely, easily and quickly recovering the lost or forgotten SQL user password including SA password with advanced techniques. Follow the below steps and you will be possible to get back your forgotten SA password in a second!
Step 1: Free download SA Password Recovery program and install it correctly onto your computer where the SQL Server is installed.
Step2: In the interface of this program, click “Open” to get access to master.mdf file which is defaulted in: C:\Program Files\Microsoft SQL Server\MSSQL\Data\master.mdf.
Step3: All the accounts will be displayed in a list, then just select sa account and change sa password by clicking “Change Password”.
One more tip here: After you regain access to the SA account, I would suggest you to rename the SA account due to security reasons. Everyone knows the account SA, so that the hackers may try to bruteforce your system or just try to guess the wrong password. After their attempts, several unsuccessful attempts can make the SA account get locked out.