By Default in SqlServer, new database files are being created and stored in %Program Files%\Microsoft SQL Server\MSSQLXXX.MSSQLSERVER\MSSQL\DATA. This path can be changed to desired or configured path.
To change Data and log files path
- Connect to SqlServre using SSMS
- Select connected Server and then Properties
- From Server properties –> Select Page (left side) –> Database Settings
- Update Database default locations – Data/Log/Backup paths
- Close the connections and restart the SQL server service. As per Microsoft must restart SQL Server service to take the effect
It can be done via the Configuration Manager, or via the services.msc from Control Panel–> Administrative Tools