Problem
Error 5123 is displayed when you’re trying to attach a database in SQL Server 2008 R2 that was previously detached by another user with a different login.
CREATE FILE encountered operating system error 5 (Access is denied) while attempting to open or create the physical file… (Microsoft SQL Server, Error 5123)
Solution
- In the Security tab of the Properties dialog, selected OWNER RIGHTS in the “Group or user names” section, the listed permissions were empty for both Allow and Deny.
- Click on Advanced and, from that view, OWNER RIGHTS had all permissions checked.
- Click Edit and ensure that all check boxes are set for Allow.