Thursday, December 07, 2023
Home » SQL Server » Troubleshoot Cannot Open MDF File Due to MDF Access Denied Error

Troubleshoot Cannot Open MDF File Due to MDF Access Denied Error

Written By Aswin Vijayan
Mack John
Approved By Mack John  
Published On March 23rd, 2023
Reading Time 4 Minutes Reading

There are various cases in which users face MDF access denied error and cannot open MDF File. For example, an employee creates a database of an organization and save it at the location where SQL Server is not installed, after sometime another employee, tries to attach that database to SQL Server but they got MDF access denied error message and unable to open MDF File.
In order to resolve this error, he/she try to find a way so that they can be able to attach or view the database in MS SQL Server.

Here we will find the reason why MDF access is denied, why users cannot open MDF File and discuss manual and automated ways to resolve this problem.

So, Let’s Get Know Why Users Face Problems To Open MDF File?

SQL Server Administrator provides the ability to perform various activities, but there are some activities that required explicit permission to work properly.

And this is a window related issue where SQL Server does not have appropriate permission to the folder that contains files. So, this shows MDF access denied error while users try to open MDF File.

If we attached database from the same location where SQL Server is installed in such cases security permission is not required and no MDF access denied error will be generated.

The most general problem that makes users unable to view MDF File is that, when they try to attach MDF File from the location where SQL Server is not installed then, they get MDF access denied error message.

Hence the main cause of the problem is, due to the conflict of permission.

Well-Rounded Approaches To Resolve MDF Access Denied Error

In this section, we will discuss the manual and automated way to attach MDF File to the MS SQL Server. So that users can easily attach the file to the SQL Server, and view the database. Following methods will be discussed to open MDF File:

  1. Give permission to the folder
  2. Run SSMS through administrator rights
  3. Use MDF Viewer Pro Software

Method 1. Grant permission To Resolve MDF Access Denied Error

After knowing that, error message is generated due to conflict of security permission and why MDF access is denied.

Let’s know about how to give permission to all the files of the system?

Step 1. Go to the folder where you have stored MDF File

 provide permission to open MDF file

Step 2. Select file → Right-click → Click on Properties

security permission to resolve MDF access denied error

Step 3. Give permissions to file for logged-in user security

open File without MDF access denied error

Step 4. Click on OK button.
After performing all these steps users can easily attach file from any location of the system to SQL Server.

Method 2. Open SSMS Through Administrator Rights

If you use SQL Server Management Studio with Administrator rights then there is no need to provide security permission to the files. You are able to attach files from any location of the system. To run SQL Server with administrator you need to:

  • Log off your computer / Close SQL Management Studio
  • Run your SSMS with administrator
  • Try to attach file or restore it.

Method 3. Use MDF Viewer Pro To Open MDF File

SysTools MDF Viewer Pro Software provides the preview of corrupted MDF File without any appropriate security permission to the folder that contains files and export data into SQL Server. It is an adept software used to analyze the objects of MDF file and preview the following database object.

Purchase Now

  • Tables
  • Triggers
  • Stored procedures
  • Views
  • Functions

Below we have mentioned some silent features of the software.

    1. Recover MDF file of SQL Server 2019, 2017, 2016, 2014, 2012, and below versions.
    2. Provide dual scanning mode, Quick scan and Advance scan.
    3. Recover deleted records o SQL Server tables.
    4. Successfully run on Windows 2000, 2003, XP, Vista, 7, 8, 8.1 & Windows10.
    5. Recover corrupted and inaccessible MDF files.
    6. Migrate SQL Server data from one server to another.
    7. Export Database objects with only schema or with schema and data.

Let’s See How The Software Works?

Step 1. Download and install the software

Run MDF Viewer Pro

Step 2. Click on open button to add MDF File

Add file to preview Database

Step 3. Select a scanning mode to scan file

Scan MDF File

Step 4. After scanning completion preview database objects

preview objects of database

Step 5. Click on export button to export data into SQL Server database.

export data to open MDF File


To attach MDF File which is saved on the same location where SQL Server is installed, users do not need any security permission. If users want to attach or open MDF File from any other location of the system then, users need to provide security permission to the folder in which files are stored. Or you can simply use MDF Viewer Pro Software, this software makes you enable to open MDF File without any access denied error.

You can use any method, they will definitely help you to resolve MDF access denied error.