在Sql Server 2008 R2里附加数据库时弹出xxx.mdf拒绝访问的错误

SQL Server 2008R2 附件数据库问题记录-LMLPHP

详细错误信息如下:

TITLE: Microsoft SQL Server Management Studio
------------------------------

Attach database failed for Server 'DESKTOP-QVD8O8E\SQLEXPRESS'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1540+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Unable to open the physical file "E:\DataBases\AdventureWorks2008R2_Database\AdventureWorks2008R2_Data.mdf". Operating system error 5: "5(拒绝访问。)". (Microsoft SQL Server, Error: 5120)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

解决方法:

将存放xxx.mdf的文件的上一层目录的权限加上Everyone角色并勾上“完全控制”保存即可解决

05-11 20:01