How to Recover the Password of SQL Server Database File (.mdf)?

Manoj Shukla
4 min readNov 25, 2020

SQL Database is developed by Microsoft Corp. SQL Server database is RDBMS i.e. Relational Database Management System. It is used to store SQL (Structured Query Language) code which creates databases and stores data in the database. The SQL databases are secured with a unique security password which is different for different database users. The title “How to Recover the Password of SQL Server Database File (.mdf)?” confirms the motive of this blog. Let’s try to understand the SQL password recovery process.

How do We Recover SQL Server Database Password?

In some cases, users may forget the unique password, then try reinstalling their SQL and re-attaching their databases. So, we are here to tell you the correct way to resolve the issue. SQL Server provides multiple ways to recover the password. Let’s move forward to Recover SQL SA password.

Manual Method to Recover password

  1. First, open your SQL manager.
  2. Then, stop the SQL Server Instance.
  3. Now, open the properties on the SQL Server Instance(for adding single-user mode).

4. Now, write in the text field -m or –f in the Startup Parameter, then click on the Add button.

5. Next, hit the Apply button.

6. Then, restart the SQL Server to start SQL in single-user mode.

7. After, launch the Command Prompt.

8. Now, run SQLCMD and tap the Enter key.

9. Run a Transact-SQL command to include a new account or an existing account.

EXEC sp_addsrvrolemember ‘DOMAIN\Username’, ‘sysadmin’; GO

10. Then, launch the SQL Server Configuration Manager.

11. Now, stop the SQL Server Instance.

12. Again, click the properties on the SQL Server Instance and then press the Advanced tab.

13. This time, remove the character -m, then click Ok.

14. After, start the SQL Service Instance.

15. At the last, open the Microsoft SQL Server Management Studio.

  • Expand the Security and login in your Database.
  • Now, open the properties and reset the password.

The manual method is not difficult to recover SQL Server user password but due to repeated occurrence of the error, one cannot recover the password properly. So, one must redirect to the profound solution to resolve the issue. It also saves your MSSQL Database from suspect mode.

Automated Method to Recover SQL Server Database Password

If you can’t recover the password with the earlier manual methods, then you may better choose this professional method. Here, I recommend you to use a third-party tool named SQL Password Recovery.

So, you need to download a third-party tool as the tool does not only recover the SA password on Microsoft SQL Server and also recover the user’s password.

SQL Password Recovery tool is used to recover SA password of the MS SQL.
SQL SA Password Recovery Tool

The tool is implemented with a simple and user-friendly GUI, therefore, even a non-technical user can find it easy to operate. This tool is 100% secure and reliable, so it is always upheld by expert persons.

Now, let’s redirect towards the features section where we get some more information about the tool.

Features

  • This tool will help you to reset the password.
  • It allows the user to reset the SA password without installing the SQL server.
  • This tool will reset both the User and Administrators passwords from the .mdf file (SQL master file ).
  • It can change the password of SQL Server database 2016, 2014, 2012, 2008 R2, 2008, 2005, and 2000.

There are other important features of this tool. But, let’s move ahead with the working of this professional tool.

Working of SQL Password Recovery Tool

With this third party tool, you can easily recover SQL Server user password. Let’s take a look at its working procedure.

  • First, download and run the SQL Password Recovery tool
  • Then, browse the master file (choose your master file from your system) and then click Open.
  • Now, select the User Name from the User List.
  • In the following popup, tick either the Remove Password or Change Password checkbox. ( Enter new password in the text field area)
  • Next, click on the Change Password button.
  • After, you will successfully recover SQL SA password from the selected user name.
  • Lastly, click on the Yes button to close the application.

Final Words

In this blog, we explored different ways to Recover SQL Server Database Password. We have discussed the two kinds of approaches one is Manual and the other is the automated method. So, you can pick anyone from them. We strongly recommend a user to go through the professional method from where he/she can easily recover SQL password from hash. Hope this blog will help an individual to recover the SQL database. Thanks for reading this blog.

--

--