Unable to connect any database to SQL Server 2012

Ok, here is what I get:

Failed to get data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
Additional Information: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
CREATE FILE detected an operating system error 5 (no error was found) when trying to open or create a physical folder "C: \ Program Fifes (x86) \ Microsoft SQL Server \ MSSQL.1 \ MSSQL \ Data \ MyCompany.mdf. (MIcrosoft SQL Server, error: 5123)

I have already reinstalled SQL Server 2012 and it still does not work. Before this problem, I tried to attach the AdventureWorks database and insert some command (I deleted it), and since then I have been having this problem. I am new to SQL Server.

thanks

+4
source share
3 answers

This is a resolution issue. The account running the SQL Server process does not have write access to the program folder. Either you add these permissions to an account that uses the SQL Server service, or you add your database in the place where the SQL Server service account has read / write permissions.

See this DBA Stackexchange question for the same issue.

+11
source

if you are using SSMS, try running it as an administrator.

+16
source

Make sure your .mdf file is not in read-only mode. If it is in read-only mode, select its properties and disable read-only and click OK, and then attach the file. It really works

0
source

Source: https://habr.com/ru/post/1490530/


All Articles