The SQL Server attached database reports an error that the physical file cannot be opened, and the import mdf file appears: the physical file "D:\XX.mdf" cannot be opened. Operating system error 5: "5 (Access is denied.)" solutions

 

This error will occur when the operating system above Win7 is attached, which is caused by the file access permission problem of Windows. There are two solutions: 1. After setting the current operating system user to have full control authority on
    the folder where the database file is located In addition, this method requires authorization for each database folder.
 

Solution:

In the directory where the database is located , that is, the folder where the mdf and ldf files are stored, find the .mdf file, right click -> properties -> security -> select the current user -> edit, check "full control" - after confirming quit. [The same is true for the security permissions of the .log file]

 

Guess you like

Origin blog.csdn.net/zgscwxd/article/details/131291089