SQL Server 操作系统错误 5:“5(访问被拒绝.)" [英] SQL Server Operating system error 5: "5(Access is denied.)"
问题描述
我开始学习 SQL,我有一本书提供了一个可以使用的数据库.下面的这些文件在目录中,但问题是当我运行查询时,它给了我这个错误:
<块引用>Msg 5120, Level 16, State 101, Line 1 无法打开物理文件C:\Murach\SQL Server 2008\Databases\AP.mdf".操作系统错误5:5(访问被拒绝.)".
创建数据库 APON PRIMARY (FILENAME = 'C:\Murach\SQL Server 2008\Databases\AP.mdf')登录(文件名 = 'C:\Murach\SQL Server 2008\Databases\AP_log.ldf')附件走
在书中作者说它应该有效,但在我的情况下它不起作用.我搜索过,但我不知道到底是什么问题,所以我发布了这个问题.
SQL Server 数据库引擎服务帐户必须具有在新文件夹中读/写的权限.
查看
I am starting to learn SQL and I have a book that provides a database to work on. These files below are in the directory but the problem is that when I run the query, it gives me this error:
Msg 5120, Level 16, State 101, Line 1 Unable to open the physical file "C:\Murach\SQL Server 2008\Databases\AP.mdf". Operating system error 5: "5(Access is denied.)".
CREATE DATABASE AP
ON PRIMARY (FILENAME = 'C:\Murach\SQL Server 2008\Databases\AP.mdf')
LOG ON (FILENAME = 'C:\Murach\SQL Server 2008\Databases\AP_log.ldf')
FOR ATTACH
GO
In the book the author says it should work, but it is not working in my case. I searched but I do not know exactly what the problem is, so I posted this question.
SQL Server database engine service account must have permissions to read/write in the new folder.
Check out this
To fix, I did the following:
Added the Administrators Group to the file security permissions with full control for the Data file (S:) and the Log File (T:).
Attached the database and it works fine.
这篇关于SQL Server 操作系统错误 5:“5(访问被拒绝.)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!