Open the folder that contains the database file that you want to attach, which is the same folder as the file that has the. mdf extension, as shown in:
Right-click the MDF file and select Properties, as shown in:
Click the Security tab as shown in:
Click the Edit button as shown in:
In the popup dialog box, select "Authenticated Users" in "group or user name" as shown in:
Under Authenticated Users ' permissions, tick "Full Control", "Full Control" is checked (remember that the . log file is also fully controlled ), and the following permissions will be automatically checked as shown:
Finally click "OK" to do it. Once you have modified the permissions, you will be able to attach the database successfully. This is the most common method, the success rate is relatively high, occasionally unsuccessful cases, please refer to the following two methods.
SQL Server attached database denied access