Cannot connect to local SQL Server Express 2008 R2
Asked Answered
G

4

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)

Glair answered 14/5, 2011 at 12:58 Comment(2)
Try connecting to whatever your machine name is instead of local... it seems to be a bit flakey sometimesSelfidentity
Answer: In the server name field I chnged from '(local)' to '[Comp-Name]\SQLEXPRESS'Glair
R
82

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

Riess answered 14/5, 2011 at 13:4 Comment(7)
Thankyou verymuch chris. That dot(.) before SQLEXPRESS solved my problem.Spleenful
Is there a technical term for this type of path? What does the dot represent? localhost?Starveling
@Jared yes the dot is shorthand for (local) or localhost. The \SQLEXPRESS part is the instance name.Riess
Make sure SQL browser service is turned on!Lycaon
Thank you! That's not too obvious, huh!?!?! :)Chi
@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 .\SQLEXPRESSRiess
@ChrisFulstow Thanks for the response, thanks for the answer by the way, saved me a real headache!Every
S
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.

Sewan answered 26/3, 2012 at 13:9 Comment(1)
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.Feudalism
L
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

Lockup answered 10/6, 2013 at 21:36 Comment(2)
If you don't do this install often, this part is easy to forget...I did.Leshia
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!Kershner
H
0

hope it will help you

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

it is working.....

Heffner answered 19/1, 2014 at 9:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.