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)

2
  • Try connecting to whatever your machine name is instead of local... it seems to be a bit flakey sometimes Commented May 14, 2011 at 13:02
  • 4
    Answer: In the server name field I chnged from '(local)' to '[Comp-Name]\SQLEXPRESS' Commented May 14, 2011 at 13:05

4 Answers 4

82

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

Sign up to request clarification or add additional context in comments.

7 Comments

Thankyou verymuch chris. That dot(.) before SQLEXPRESS solved my problem.
Is there a technical term for this type of path? What does the dot represent? localhost?
@Jared yes the dot is shorthand for (local) or localhost. The \SQLEXPRESS part is the instance name.
Make sure SQL browser service is turned on!
@SelectDistinct by default SQL Server Express is installed as a named instance, so you need to specify the server (local) as well as the instance name, so (local)\SQLEXPRESS or shorthand .\SQLEXPRESS
|
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.

1 Comment

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.
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

2 Comments

If you don't do this install often, this part is easy to forget...I did.
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!
0

hope it will help you

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

it is working.....

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.