how to fix this error

Ujwala Desai 0 Reputation points
2026-10-23T19:03:36.11+00:00

TITLE: Error


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: https://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476


ADDITIONAL INFORMATION:

The system cannot find the file specified


BUTTONS:

OK


SQL Server Database Engine
0 comments No comments

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 138.4K Reputation points MVP Volunteer Moderator
    2026-10-23T21:30:34.27+00:00

    You fix this error by troubleshooting. The error message means that you were not able to reach the SQL Server instance you specified. Since you give no context or indicate why you expect connection to succeed, I can only list some common reasons:

    • SQL Server is not running.
    • You misspelled the server and/or the instance name.
    • You are connecting to a remote instance, and there is a firewall blocking the traffic.
    • You are connecting to a name instance on another server, and the Browser service is not running on that server.
    • All you did was to download and install SQL Server Management Studio, and you are trying to connect to something which does not exist. In this case you need to download SQL Server as well.

    You are welcome to come back with further questions, but it absolutely helps if you tells us more about your situation. Only dumping an error message is not a good way to get help.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-10-23T19:04:16.7466667+00:00

    The first check is to identify the installed SQL Server Database Engine instance and connect with its exact name, because SSMS alone does not install or provide a SQL Server instance.

    1. Verify that SQL Server—not only SSMS—is installed

    Open SQL Server Configuration Manager, then select SQL Server Services.

    Look for one of these entries:

    • SQL Server (MSSQLSERVER) — default instance; connect using:
      • localhost
      • .
      • Your computer name
    • SQL Server (SQLEXPRESS) — named Express instance; connect using:
      • localhost\SQLEXPRESS
      • COMPUTERNAME\SQLEXPRESS
    • SQL Server (OtherName) — connect using:
      • COMPUTERNAME\OtherName

    The text inside parentheses is the instance name. Do not use the SQL Server Agent service name. Microsoft documents this naming distinction in its connection troubleshooting procedure.^1^

    If SQL Server Configuration Manager contains no SQL Server Database Engine service, install SQL Server Database Engine. SSMS is only the administration client and cannot act as a local database server.^2^

    2. Start the identified instance

    In SQL Server Configuration Manager → SQL Server Services:

    1. Find SQL Server (instance-name).
    2. If it has a red stopped indicator, right-click it and select Start.
    3. Confirm that it changes to a green running indicator.
    4. Retry the connection using the corresponding server name from step 1.

    If the service fails to start, this is a Database Engine startup issue rather than an SSMS network connection issue. Record the startup error shown by Configuration Manager or Windows Event Viewer.

    3. Test a local connection before changing network settings

    On the computer running SQL Server, try the exact instance name in SSMS.

    For a default instance:

    localhost
    .
    COMPUTERNAME
    

    For a named instance:

    localhost\SQLEXPRESS
    COMPUTERNAME\SQLEXPRESS
    

    If the local connection succeeds, the Database Engine and instance name are valid; continue only if the failing client is on another computer.

    4. If connecting from another computer, enable TCP/IP

    On the SQL Server computer:

    1. Open SQL Server Configuration Manager.
    2. Go to SQL Server Network Configuration → Protocols for instance-name.
    3. Right-click TCP/IP and select Enable.
    4. Return to SQL Server Services.
    5. Right-click SQL Server (instance-name) and select Restart.

    A protocol change does not take effect until the Database Engine is restarted.^1^

    Then test whether the server is reachable from the client:

    ping COMPUTERNAME
    Test-NetConnection COMPUTERNAME -Port 1433
    

    Port 1433 is typical for a default instance, but a named instance can use a different port. The active port can be found in the SQL Server error log by filtering for server is listening on.^1^

    • If TcpTestSucceeded is False, check the server firewall and network routing for the actual listening port.
    • If it is True, try an explicit TCP connection in SSMS using tcp:COMPUTERNAME,PORT.

    5. Named-instance fallback

    If tcp:COMPUTERNAME,PORT works but COMPUTERNAME\INSTANCE does not, instance-name discovery is failing. Use the explicit TCP server-and-port form or investigate SQL Server Browser and the network/firewall configuration. Microsoft identifies incorrect host resolution and incorrect TCP port selection as common reasons the client cannot locate an instance.^1^

    Only investigate Windows permissions for Named Pipes if the connection consistently fails specifically under certain Windows users. In that condition, Microsoft’s documented resolution is to add the affected account to the server’s Users group.^3^


    References

    1. A network-related or instance-specific error occurred while establishing a connection to SQL Server
    2. how to fix SQL server management on my PC - Microsoft Q&A
    3. Named Pipes connections cause failure to SQL Server
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

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