Microsoft SSMS displaying the following instance error

Jatin Malla 1 Reputation point
2022-07-10T09:07:05.277+00:00

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)

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,423 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Erland Sommarskog 116.4K Reputation points MVP
    2022-07-10T09:43:25.763+00:00

    This error means that SSMS could not find the SQL Server instance you wanted to connect to. This is a very common error, and you will have to troubleshoot many times during your career with SQL Server. Possible reasons include:

    • You misspelled the server and/or the instance name.
    • The instance is not running.
    • There is a firewall blocking the connection.
    • SQL Server is not configured to accept remote connection.
    • You are trying to connect to a named instance, but the Browser service is not running.
    • All you did was to download SSMS and there is no SQL Server instance anywhere close to where you are.

    And that list is not exhaustive. If you want more specific help, you need to tell us which troubleshooting steps you have taken and why you expect the connection to work.

    Also see this general troubleshooter.

    0 comments No comments

  2. Olaf Helper 45,811 Reputation points
    2022-07-11T05:46:00.977+00:00

    The server was not found or was not accessible

    What else to say then the error message already do.

    0 comments No comments

  3. CathyJi-MSFT 22,346 Reputation points Microsoft Vendor
    2022-07-11T06:11:17.51+00:00

    Hi @Jatin Malla ,

    Please follow below steps to troubleshot this issue,

    1. Make sure SQL Server Service is running
    2. If a named instance, make sure SQL Server browser service is running. Make sure the instance name is spelled correct and there is actually such an instance on your target machine.
    3. Make sure SQL Server is configured to allow remote connections
    4. Examine the SQL Server error log for messages confirming that SQL is listening on the expected network interfaces and ports
    5. Test server connectivity with PING from the client machine
    6. Test port connectivity using TELNET to the server and port (from step 4) from the client machine. For example
      TELNET <server-name> 1433
    7. Check firewall settings if step 5 or 6 connectivity test fails

    If you have some confuse about the steps, please refer to Ultimate Solutions to Resolve MS SQL Server Error 2 or Troubleshoot connecting to the SQL Server Database Engine to get more information.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.