Where Does SQL Server Store Data Files?
SQL Server keeps .mdf and .ldf files in the instance DATA folder under Program Files, versioned by release.
Last updated
SQL Server stores each database as data and log files inside the instance DATA folder. The path carries the version and instance name, so side by side installs never collide. System databases sit in the same folder as user ones.
Detaching moves files cleanly while the server tracks them. Backups through SQL remain the portable route between machines. Match the bracketed parts below to your version and instance before scripting.
Where SQL Server stores this, by platform
C:\Program Files\Microsoft SQL Server\MSSQL[version].[instance]\MSSQL\DATA
Data .mdf plus log .ldf per database in one folder. Default instances use MSSQLSERVER as the name. Move files with detach and attach, not Explorer drags.
/var/opt/mssql/data
Same .mdf and .ldf layout on Linux installs. Permissions belong to the mssql user. Back up with sqlcmd jobs rather than volume snapshots alone.
Frequently asked questions
How do I move a database to another drive?
Detach it, move the .mdf and .ldf, then attach from the new path. Update any jobs pointing at the old folder. Keep a full backup from before the move.
Where are backups by default?
In the Backup folder beside DATA at the same instance root. Change it per job to a dedicated volume. Default paths suit testing, not production retention.
Notice an outdated path? Let us know.