Connecting to a local SQL Server instance fails with an error

9,225

You haven't mentioned what authentication method you have selected when installing SQL Server. I'm assuming it was Windows authentication. Make sure you're authenticating with a correct account (the one you've choosen when installing SQL Server). If you have changed your mind and want to use another account to connect to your server, you can do it by starting the installer again and choosing to perform maintenance on existing instance of the server.

Check your server name. These are example values that let me connect to my local server, assuming my computer name is GRON, I'm using Windows auth and my username is gronostaj: (it's SQL Server 2012 but it doesn't matter)

Example connection details

Third thing to check is if your server is actually running. Check if the SQL Server service is enabled and running:

  1. Press Win+R and type services.msc, press Enter
  2. Find SQL Server (MSSQLSERVER) in the list, double click it.
  3. Make sure Startup type is Automatic or Manual (Automatic means that server will start with Windows, with Manual you'll have to start it by hand).
  4. In the same window check Service status, it should be Started. If it's not, click Start and wait until a progress window disappears. Service status should change to Started.

This is how the service configuration window looks like when you want to start the server manually and it's already up and running:

Example configuration for MSSQLSERVER service

Now you should be able to connect to the server using settings mentioned above. If it still doesn't work, you can try to verify if the server is running on the expected port 1433.

  1. Press Win+R again, type cmd and confirm with Enter. A command line will appear.
  2. Type telnet localhost 1433, press Enter.
  3. If you can see a message Connecting To localhost... then the server is running on a non-default port. If it flashes briefly, followed by a blank console window then the server is running and awaiting connections, you should recheck your authentication data and server name.
Share:
9,225

Related videos on Youtube

Basheer Kharoti
Author by

Basheer Kharoti

So ready to help :)

Updated on September 18, 2022

Comments

  • Basheer Kharoti
    Basheer Kharoti almost 2 years

    I have installed MS SQL Server 2008 R2 with authentication mode but when now when I click to the connect I gives such kind of error:

    A network-related or instance-specific error occurred while establishing a connection to SQL server. The server was not found or not accessible. Verify that the instance name is correct.