I was on vocation and when I came back and try to start SQL server. It gives me below error.
Connect to Server
Cannot connect to localhost.
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)
I was quite surprised what the problem is. After investigating I find out that I need to start the SQL Server from configuration tool. So here is the solution.
Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server Services.
Check if SQL Server is running. If not then right click on MS SQL Server and click run.
Recently while working on MS SQL Server 2008 R2, I faced the same issue. When I was trying to connect MS SQL Server on my machine I faced the same issue. But the solution I mentioned earlier not helped me. So then I fix the issue with the following steps,
Open the SQL Server Configuration Manager, and click on SQL Server Network Configuration, and select the TCP/IP. And it its not enable then enable it. After that right click and open the properties window. Click on IP Addresses tab and make sure its IP1 is active and enabled.
Enable TCP/IP services
Click on and then restart the SQL Server services. To restart the services, open the Administrative tools from the Control panel of your Windows operating system. And click on Services, locate the SQL Server services and if it’s not start just start the service or if it’s already running just restart the service. And you are good to go.
Start the SQL Server services