Search code examples
database-administration

Msg 5123, Level 16, State 1, Line 1 CREATE FILE encountered operating system error 5(Access is denied.)


How can I resolve this error:

Msg 5123, Level 16, State 1, Line 1 CREATE FILE encountered operating system error 5(Access is denied.)

while attempting to open or create the physical file 'C:\Banking.mdf'.


Solution

  • You need to ensure that you have the appropriate account permissions on the account in order to access the folder the mdf file is located in.

    More detail can be found in the following link.

    https://dba.stackexchange.com/questions/22250/sql-server-create-file-encountered-operating-system-error-5-access-is-denied