Location of Master MDF files
The following question was asked on my website:
What file does SQL Server use to find the location of the master.mdf file?
website question
Without context this could mean a few different things. Are you trying to find out where master.mdf is located, or are you trying to move it?
The answer is its not saved in a config file, it is stored in the registry editor. Now that’s that quite true since the registry data is stored somewhere in a file, but I think that it out of the context of this question.
The actual path may vary depending on the version of SQL Server, but it looks something like this:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL15.SQL2019\MSSQLServer\Parameters
You can also get to it through the SQL Server configuration manager.
The three startup parameters shown there explained are:
- -d The path to the master database primary file.
- -e The path to the SQL Server error log file.
- -l The path to the master database transaction log.
If you were interested in just looking these up, you could do that with a TSQL query:
USE master;
GO
SELECT *
FROM sys.database_files;
I hope this helps answer the question.
-Steve Stedman
More from Stedman Solutions:
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!
Leave a Reply