How to fix: A Network-related or instance-specific error occurred while establishing a connection to SQL Server
How To

How to fix: A Network-related or instance-specific error occurred while establishing a connection to SQL Server

Editorial Team
Editorial Team

Follow us on Discord or Telegram to get access to free tutorials and updates.

Sometimes, SQL Server Management Studio throws this error when trying to connect to the SQL Server.

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)

We get the SQL 40 Error when the SQL Server fails to respond to the client request. Following are the possible causes of this error:

  • SQL Server Service is not started.
  • SQL Server Instance is not accessible due to firewall or any reason.
  • Telnet port 1433 or port on which SQL Server is running is blocked
  • TCP/IP or Named Pipes protocol is disabled in SQL Server Configuration Manager.
  • Remote Connection is disabled for this SQL Server Instance.

How to fix?

Method 1

Go to the Services Console (Hit Win +R and type services.msc) and look for SQL Server (MSSQLSERVER. If it is not started, start the service.

Method 2

You can also start the service by running net start mssqlserver in an elevated command prompt.