Share via

My SSMS is installed but cannot connect. Error 40. SQL services are running but default instance fails.

RAJAT GUPTA 0 Reputation points
2026-01-22T05:20:06.92+00:00

My SSMS is installed but cannot connect. Error 40. SQL services are running but default instance fails.

SQL Server Database Engine

Answer recommended by moderator

  1. Lakshmi Narayana Garikapati 1,315 Reputation points Microsoft External Staff Moderator
    2026-01-22T07:41:14.1533333+00:00

    Common Quick Fixes

    1. Start SQL Server Browser service.
    2. Use localhost\SQLEXPRESS instead of machine name.
    3. Enable TCP/IP and restart SQL services.
    4. Add firewall exception for SQL Server.

    If it’s still not working, then you can follow the troubleshooting steps below

    1. Check SQL Server Configuration Manager
    • Ensure the SQL Server (SQLEXPRESS) service is running.
    • Verify that the SQL Server Browser service is also running (needed for named instances like SQLEXPRESS).
    1. Confirm Instance Name
    • In SSMS, try connecting with just localhost or . instead of LAPTOP-O93FQNH9\SQLEXPRESS.
    • If you installed only the default instance, the name might be just the machine name without \SQLEXPRESS.
    1. Enable TCP/IP Protocol
    • Open SQL Server Configuration Manager → SQL Server Network Configuration → Protocols for SQLEXPRESS.
    • Make sure TCP/IP is enabled.
    • Restart the SQL service after enabling.

    4.Check Port Binding

    • By default, SQL Express uses dynamic ports.
    • In TCP/IP properties, set a static port (e.g., 1433) under IPAll → TCP Port.
    • Then connect using localhost,1433.
    1. Firewall Rules
    • Ensure Windows Firewall allows inbound connections on the SQL Server port (1433 if static).
    • Add rules for both sqlservr.exe and the port.
    1. Test Connectivity with UDL File
    • Create a .udl file and test connection outside SSMS to confirm if the issue is SSMS-specific or network-level.

    Hope This helps!

    Thanks,

    Lakshmi.

    Was this answer helpful?


2 additional answers

Sort by: Most helpful
  1. RAJAT GUPTA 0 Reputation points
    2026-01-22T05:32:07.25+00:00

    still notnworking help me pls

    Was this answer helpful?

    0 comments No comments

  2. Q&A Assist
    2026-01-22T05:20:18.7433333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error message "Error 40" typically indicates that the SQL Server instance cannot be found or accessed. Here are some steps you can take to troubleshoot this issue:

    1. Verify SQL Server is Running: Ensure that the SQL Server services are indeed running. You can check this in the SQL Server Configuration Manager.
    2. Check Instance Name: Make sure you are using the correct instance name when connecting. If it's a default instance, you should just use the computer name. For a named instance, use <computer name>\<instance name>.
    3. Firewall Issues: There may be a firewall blocking the connection. Ensure that your firewall settings allow SQL Server traffic.
    4. Remote Connections: Ensure that SQL Server is configured to allow remote connections. This setting can be checked in SQL Server Management Studio under server properties.
    5. Network Protocols: Check that the necessary network protocols (like TCP/IP and Named Pipes) are enabled in SQL Server Configuration Manager.
    6. Test Local Connection: Before troubleshooting from a remote computer, try to connect locally using SQL Server Management Studio or the sqlcmd.exe utility to rule out network issues.

    If you continue to face issues after these checks, you may need to gather more information about your SQL Server setup and configuration.


    References:

    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.