Moving it to the DATA folder basically solved the resolution problem. Another solution is to change the access rights to the file (or files) and, thus, the presence of the database in another folder. I just encountered a similar permission error "CREATE FILE encountered an operating system 5 error (Access is denied.)", Trying to connect DB in SQL Server 2012 Express in Windows 7.
The solution I made is the following: 1) Rich-click on each MDF, LDF and NDF file to get the menu β select properties 2) Add users for the computer and give them full control (instead of all, dangerous ones)
After that, I could connect the database.
However, even if it is not moved to the DATA folder, you must go to a subfolder instead of C: \ root (example: C: \ mydb).
source share