Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permissions required for the DATA folder

I have Sql Server 2017 and the Data folder is the default at C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL. The access rights on the folder are:

enter image description here

I have an old database with its MDF file in My SQL Database. I tried to duplicate the same rights to My SQL Database:

enter image description here

I couldn't duplicate those for ALL APPLICATION PACKAGES as I don't know who it is.

With the above rights on My SQL Database I couldn't reattach a database from its MDF file in that folder. It keeps saying Operating system error 5: "5(Access is denied.)" on the MDF file.

What access permissions are required to have database files in another folder other than the default?

like image 219
Old Geezer Avatar asked Feb 19 '26 00:02

Old Geezer


2 Answers

Execute the following SELECT:

SELECT * FROM sys.dm_server_services

And check the value of service_account for the servicename thats SQL SERVER:

enter image description here

Then make sure that the folder and the files have the proper access rights for that account.

like image 124
EzLo Avatar answered Feb 20 '26 13:02

EzLo


Add your user account in Advanced Security Setting of the Data folder with Full Control access enter image description here

like image 36
EhsanSafari Avatar answered Feb 20 '26 15:02

EhsanSafari