34

I just installed SQL Server Express 2008 R2 and I have a problem connecting to it using the SQL Server Management Studio (locally).

All SQL Server services are started (SQL Server (SQLEXPRESS), SQL Server browser, also the DTC service)

When I try to connect I get the following message:

TITLE: Connect to Server

Cannot connect to (local).

ADDITIONAL INFORMATION:

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)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Alon Ashkenazi
  • 1,223
  • 4
  • 21
  • 29

4 Answers4

82

Are you connecting to the local express instance? Try this as your server: .\SQLEXPRESS

Chris Fulstow
  • 41,170
  • 10
  • 86
  • 110
16

The same error can happen if your SQLEXPRESS instance is not started. To verify the service is started: - run services.msc - Look for the "SQL Server (SQLEXPRESS)" service, status should be "Started", if it is not, try to start it manually.

  • This is also a way to find out the name of the instance if it was installed by someone else. eg if it says "SQL Server (DevSQL3)" then you try to connect to MyCompName\DevSQL3. – SteveCav Aug 21 '13 at 01:38
12

I had the same error and I had to enable TCP/IP protocol and set IPALL TCP Port to 1433 to resolve the issue:

SQL Server Configuration Manager settings

nightcoder
  • 13,149
  • 16
  • 64
  • 72
  • If you don't do this install often, this part is easy to forget...I did. – ramnik Aug 10 '13 at 05:05
  • I love you. This was my error.. hours thinking why I can't connect if I enabled TCP/IP. Why can I connect in Management Studio but not in HeidiSQL or JDBC, why why.. life was a shadow of what it once was, the future was as brittle as a bone with Osteoporosis. And then I saw your post. In IP Addresses tab, scroll down past all the crap and in the IP All -> just set the TCP Port to the default one (the default, that by default isn't set in 2008 R2 :| ) Thanks! – Ric Jafe Oct 31 '16 at 11:08
0

hope it will help you

 server name try this: (local)\SQLEXPRESS or localhost\SQLEXPRESS.

it is working.....

Venu immadi
  • 1,585
  • 11
  • 20