Monitor Work from Home Employees with Employee Desktop Live Viewer.

Read More

MDF File Location in SQL Server 2014, 2016, & 2017

Yatendra Singh Yatendra Singh Updated On - 11 Jun 2020

Microsoft SQL Server stores two types of data files in default directories on respective systems, which are known as Master Database Files and Log Database Files, and abbreviated as MDF and LDF data files. Both these files are primarily available in the SQL Server environment.

However, a database can also have the NDF data file, which is known as a non-primary or secondary data file. Thus, the precedence of the MDF file is slightly higher than that of NDF, but both play an important role in holding crucial database information.

It is possible to access/open the MDF file either on the same or different computer system using third-party standalone software, and this eliminates the need to have the SQL Server installed & configured on the system and thus, saves time, extra efforts, and money.

In this article, we’ll guide you through the default MDF file location in SQL Server 2014, 2016, and 2017 followed by shedding light on how to open and view MDF files without SQL server.

Default Location of MDF File in SQL Server

Files that are common and used by all instances on a single system are installed inside the folder :\Program Files\Microsoft SQL Server\nnn\.

Here, represents the drive letter in which all the SQL components are installed, and represents the combination of both major & minor version of the SQL Server application.
Note: For most program installations, C drive is the default location.

Use the information given above to figure out the current MDF file location on your system; you only need to know the major and minor version number of current SQL Server installed on your PC.

Below, find the default MDF file location in different versions of Microsoft SQL Server:

Default MDF File Location for SQL Server 2014:

C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\TechForums19.mdf

Default MDF File Location for SQL Server 2016:

C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\TechForums19.mdf

Default MDF File Location for SQL Server 2017:

C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\TechForums19.mdf

Default MDF File Location for SQL Server 2019:

C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\TechForums19.mdf

Navigate to the default MDF file location given above, according to the Microsoft SQL Server version, and obtain the MDF file for whatever the purpose you need it for.

If you are aware of the location of the MDF files, then you should also know the techniques that can help you secure your database.

  • Take frequent backups
  • Many businesses take backups of the database files only when they grow in size or when it becomes necessary to take the backup. A regular backup can save the database from major issues like software related corruption, hardware related corruption or accidental deletion. When a database gets corrupt, then the backup file can help in restoring the data.

  • Verify the SQL backups
  • Taking SQL backups will be only the half the job as you need to verify the health of the backups routinely. It means that you should check the backup files and their readability and availability. Sometimes, when the size of the backup files increases, then the administrator needs to save the backups at a safe location.

  • Do not shrink database regularly
  • Many times, the administrator tries to shrink the database to save the storage space. But, there is a problem with it as it increases the fragmentation in the database. Due to the excessive database shrinking, the performance also will be affected.

  • Check database consistency
  • Sometimes, when the users runs a query to fetch the data, then they produce irrelevant information. It is because the database has some misplaced or has become corrupt. In extreme conditions, the whole server may go down.

  • Remove deadlocks
  • A single SQL Server can have multiple databases where many users are running their queries. Sometimes, a large database can have multiple queries to process and it can further create a deadlock situation. So, the administrator should check for such a deadlock situation and fix them as soon as possible.

A Simple and Free Alternative to Open and View MDF Files

Once you know the default MDF file location, the next step is to open and view its data (database objects and sub-data) stored inside, but the question is how you would open the MDF file without the SQL server? The answer is to download and use a standalone MDF viewer software.

Kernel for MDF Viewer is one such software, that assists the user in the process of opening and viewing the MDF file(s) with no software additionally needed. It enables the user to load both healthy and corrupt or damaged MDF/NDF files instantly and offers a detailed view of data. Additionally, the tool enables the user to preview items deleted from the database, preserves data integrity, and maintains file structure & original file properties.

Download Now

How to Open and View MDF File Data

Follow the steps given below to open and view MDF file:

  1. Open Kernel for MDF Viewer.
  2. Click on Browse button to open the MDF file saved at a specific and click Recover.
  3. select sql database

    Note: If the MDF file is badly corrupt or damaged then, select Advanced Mode and proceed. If the SQL database version is not detected automatically, select the SQL Database version manually, as shown below:

     select the SQL Database version

  4. Upon successful file scan and data recovery, the tool’s UI will refresh and load all database objects in the left pane, as shown below. Click on the + icon to expand an object:
  5. database objects list

    Note: Double-clicking on any object will also expand it.

  6. Now, click on any object to view its data.
  7. click on any object to view its data.

Wrap

You can figure out the default MDF file location using the tips mentioned above. The only thing you should know is the SQL Server’s major & minor version. For opening and viewing the MDF database file, Kernel for MDF Viewer is the best tool. It enables the users to repair damaged MDF & NDF files, fixes inaccessibility issues, and assists to fix data corruption in SQL server and MDF recovery. And above all, MDF Viewer won’t cost you a dime.

Download Now