Changing the default location of SQL Server Data and Log files

By: Editor
March 18, 2010


Can you explain me how can I change the default file location used by SQL Server Data and Log files?. In this article we will go through the steps which can be followed to change the default file location of SQL Server Data and Log Files.

1. Using SQL Server Management Studio, connect to SQL Server Database Engine.

2. In the Object Explorer right click the SQL Server Database Engine Instance and choose the Properties from the popup menu.

3. In Server Properties dialog box navigate to Database Settings page as shown in the snippet below. Under Database default locations you can specify the new path for Data and Log files for newly created databases. Click OK to save the changes.

SQL Server Database Settings

4. Internally, SQL Server executes the xp_instance_regwrite undocumented extended stored procedure to update the registry values. In order to makes these changes you should have admin privileges on the SQL Server and you should also have permissions to edit the REGISTRY values on the server.

Important Note

Once you have updated the database default locations go ahead and restart the SQL Server Services for the new values to come into effect.


In this article you have seen how easily one can change the default location of SQL Server Data and Log files.

Continue Free Learning...

  • Please leave below your valuable feedback for this article.
  • Feel Free to refer this article to your friends and colleagues using the below “Share this Article” option.
  • Do subscriber to our News Letter to continue your free learning.
  • Don’t forget to Like Us on Facebook and do follow us on Twitter for latest updates.

Share this Article

Geeks who read this article also read…

Follow @MyTechMantra on Twitter
We're on Facebook
Bookmark and Share

"Receive newsletters and special offers about SQL Server, BizTalk and SharePoint from MyTechMantra. We respect you privacy and you can unsubscribe at any time."