8

When I open the Management Studio and try to connect using the [PCNAME]/SQLEXPRESS it shows this error:

"Cannot connect to [PCNAME]\SQLEXPRESS"


ADDITIONAL INFORMATION:

Error Message:

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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476"

I've also tried "localhost", "local" and "." in the place for [PCNAME] but to no avail.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Alternatex
  • 1,505
  • 4
  • 24
  • 47

3 Answers3

11

Make sure SQL Server (SQL Express) service is running.

in powershell prompt type:

Get-Service -Name 'MSSQL$SQLEXPRESS'

service "status" property should be reported as "Running"

If it is not, type (you need to be in elevated prompt, i.e. "Run as Administrator"):

Start-Service -Name 'MSSQL$SQLEXPRESS'

OR

click start > type cmd and type

sc query MSSQL$SQLEXPRESS

State should be reported as "Running"

If it is not, type (you need to be in elevated prompt, i.e. "Run as Administrator"):

sc start MSSQL$SQLEXPRESS

If you get an error that the service cannot be found: Open SQL server Configuration Manager and make sure you have SQL server express installed: enter image description here

Pencho Ilchev
  • 3,201
  • 18
  • 21
  • How do I do that? I'm really a rookie at these things. Your name looks Serbian or Macedonian haha – Alternatex May 10 '12 at 23:10
  • I tried the one in cmd but it says "The specified service does not exist as an installed service." Done as administrator :S – Alternatex May 10 '12 at 23:18
  • You are trying to connect to the default sql express instance. Are you sure you have one installed? – Pencho Ilchev May 10 '12 at 23:24
  • I installed SQL Management Studio 2008 the same way as I have installed it before. I don't understand what could be the problem. – Alternatex May 10 '12 at 23:27
  • Well s**t. There's nothing there. Is it a necessity for the computer to be restarted after installation or have I messed up somewhere else? – Alternatex May 10 '12 at 23:32
  • You can try restarting the computer but I don't think that it is going to work. Please update your question with more detail on what have you installed, how and on what OS. Thanks – Pencho Ilchev May 10 '12 at 23:34
  • Ahhh.. Well I installed it on another computer through Team Viewer and I don't have any more time to perform changes or reinstall. I guess I'll have to update tomorrow.. – Alternatex May 10 '12 at 23:37
  • 4
    Installing Management Studio != Installing SQL Server. – ta.speot.is Jun 02 '13 at 02:05
1

open you sqlserver config manager enable your tcpip both sqlserver and express and also under client protocol anf try to turnoff your firewall this will allow remote connection

Angelo
  • 335
  • 4
  • 10
0

first check sql server is running or not if not start it from services.msc then add .\SQLEXPRESS it will resolve problem

prati
  • 1