Easily Find MDF File Location in SQL Server
Summary: This blog helps the user to know how to find MDF file Location in SQL Server version 2014 / 2016 / 2017 version. The user can read this blog to find the Master database file location in SQL Server.
Table of Contents
Now, these days Microsoft SQL Server is the best and successful relational database management system. It becomes the necessity of the small as well as large scale organizations. The primary function of this application is to store and retrieve the data. As we talk about the SQL server database. The SQL server stores the data in two file formats MDF and NDF file. But sometimes the users want to know SQL server MDF file location for various reasons. Let us understand the situation faced by the users:
Real User Query for MDF Location
“Please help! I am using SQL server version 2014. I have a database named project. My problem is where I can find SQL server database file MDF and transaction log file LDF file so that I can transfer my database to another user. Thanks!”
If you also want to know how to find MDF file Location in SQL Server then you are on the right page. This problem tackling blog will help the users to find MDF File location in SQL Server 2014 / 2016 / 2017 version. Before proceeding to the solution let us talk about the SQL server database files.
SQL Server Database Files MDF and LDF
Basically, SQL server stores the data in two file extensions. These files get automatically created at the time of the database creation. These two files are also part of the backup and recovery process.
- MDF file – It is the primary database files of SQL server also plays a crucial role in information storage. It holds the data and objects such as table, indexes, stored procedures, and views. if you are facing MDF file corruption then you won’t be able to access the SQL server database. In that case, you can take the help of SysTools SQL database recovery Software.
- LDF file – Transaction log file records all the transactions and the database modification performed by the user. It also contains all the information required to recover all the transaction in the SQL server database.
Know How to Find MDF File Location in SQL Server 2014 / 2016 / 2017
If you want to know where your database files are stored then the user can run this T-SQL command mentioned below:
USE master; SELECT name 'Logical Name', physical_name 'File Location' FROM sys.master_files;
This will give you list of all the data files and the log files for the SQL server instance. Therefore it’s easy for users to get MDF location without hassles.
Default MDF file Location in SQL Server 2014
C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\databasename.mdf
Default MDF file location in SQL Server 2016
C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\databasename.mdf
Default MDF file location in SQL Server 2017
C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\databasename.mdf
The user can Navigate to the MDF file location according to the SQL server version and obtain the location of SQL server MDF file for their purpose.
In case somehow your MDF files are corrupted then you can take the help of SQL MDF file recovery software. This will help you to restore your SQL Server database objects such as tables, views, stored procedure, functions, etc. Also, this utility is compatible with SQL server 2017 and its below version. Apart from this, there is no MDF and LDF files location in SQL server database.
Sometimes the users want to know how to find MDF file location in SQL Server 2014 / 2016 / 2017. In this blog, we have solved the problem faced by the user. If you are also dealing with such type of issues then you can read this blog to know MDF file location in SQL server.