Error: 5123 CREATE FILE encountered operating system error 5A(Access denied.)

HI ,

This is a problem I encountered when I had to detach a database file (type .mdf):

1) I went to the MS SQL Management Server Studi and detached my database file successfully from a connection called Workhorse.

2) I needed to place the .mdf database file into a zip file in order to put it on a remote server. I did this using Shared Portal. This was also successful

3) However when I tried reattaching the database file, I got this error:

CREATE FILE encountered operating system error 5A(Access denied.) while attempting to open or create the physical file "C\Program Files\MSSQL Server\MSSQL\Data\<databasename>.mdf'

Q) The database file and log file (ldf) exist in the correct directory so I don't know what happened. Can any one help

Thanks much

Tonante



Answer this question

Error: 5123 CREATE FILE encountered operating system error 5A(Access denied.)

  • qworq

    Hi Tonate,

    I got the solution for this. I proud this is my first blog to provide the answer on internet

    I got the same error too:

    CREATE FILE encountered operating system error 5A(Access denied.) while attempting to open or create the physical file "C\Program Files\MSSQL Server\MSSQL\Data\<databasename>.mdf'

    the solution is:

    set the Operating system permission on that .mdf file to full permission to 'Everyone' in new server.

    this will helps me to attach the database in other server..

    Have a Great Day..

    vino...


  • Com

    Dear Tonate,

    Please, take a look on the following link and might be it will help you :)

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=120536&SiteId=1



  • Michael Collins

    Well that could be a security issue, its better to give permission to the SQL Server account.

  • Error: 5123 CREATE FILE encountered operating system error 5A(Access denied.)