When I was trying to connect Sto local QL server I received an error
TITLE: Connect to Server
------------------------------
Cannot connect to xxxxxxx.
------------------------------
ADDITIONAL INFORMATION:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476
------------------------------
The system cannot find the file specified
When I tried to start SQL service from the service, I received the following error
---------------------------
Services
---------------------------
Windows could not start the SQL Server (MSSQLSERVER) on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 3417.
---------------------------
Event viewer showed the following error
FCB::Open failed: Could not open file C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\mastlog.ldf for file number 2. OS error: 5(Access is denied.).
Here is How to fix it
Open command prompt and move to
C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\SQLServer2012
The above path may vary according to your system and installation directory.
Run the following command
setup /ACTION=rebuilddatabase /INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS=[System Account user name] /sapwd=[SA user password]
It will open SQL server setup, proceed and finish the process. That’s all what you need to do