SQL Permissions for Data Folders
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
- Right-click on F:\SQL and open Properties > Security tab
- My object name would be
NT SERVICE\MSSQL$SQLEXPRESS2016. You have to enter it this way, you can't search for it.
- Grant Full Access
- 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.