I always have trouble finding how to do this. When an .mdf file is located in a folder other than the SQL's Data folder (set up during installation), it can't be seen when trying to Attach.

To make it visible, add the SQL Instance NT Service user to the folder. For example:

  • My SQL Instance is named SQLEXPRESS2016
  • My database files are in F:\SQL
  1. Right-click on F:\SQL and open Properties > Security tab
  2. Edit
  3. Add
  4. My object name would be NT SERVICE\MSSQL$SQLEXPRESS2016. You have to enter it this way, you can't search for it.
  5. Grant Full Access
  6. Save and exit

If you want to be able to use SQL's Browse button, do the same as above on the "F:" drive, but only giving Read access.