2
votes

I am really tired, it's been 3 days that I can't open my SQL Server Management Studio. I got connection string error with number 87. Below screenshot show my problem:

Picture number 1

Picture number 2

And I use localhost\MSSQLSERVER with error 87 and Arash-PC (my machine name) with error number 2.

And I tried sqlcmd -U sa -S Arash-PC too

4
Are you sure your sql server instance is running? - Evaldas Buinauskas
Try on the command line prompt telnet localhost 1433 - do you have a response (blank screen)? - Anton Krouglov
Please check the following stackoverflow.com/questions/3870966/… - dhS
If you mean in cmd window i got this error : 'telnet' is not recognized an internal or external command, operable program or batch file . - Arash
yes i run this code too : Run, type net start mssqlserver - Arash

4 Answers

18
votes

You need to check in your SQL Server Configuration Manager what services and instances you have installed. Go to Start Menu > All Programs > Microsoft SQL Server (version) > Configuration Tools and launch the appropriate Configuration Manager. You should see a screen something like this:

enter image description here

Find the SQL Server (.....) service(s), and make sure the service is started.

If you find a SQL Server (MSSQLSERVER) service started, then you have a (unnamed) default instance to which you can connect using

.
(local)
Arash-PC

You MUST NOT supply the MSSQLSERVER as the instance name!

If you find any other SQL Server (instance name) service started (e.g. SQL Server (SQLEXPRESS) in my screenshot), then the instance name (SQLEXPRESS) needs to be appended to the server name to connect to that instance:

.\SQLEXPRESS
(local)\SQLEXPRESS
Arash-PC\SQLEXPRESS
0
votes
  1. Make sure you are not running out of space on the drive where SQL is installed. Try rebooting as well.

  2. Verify that the SQL Server (MSSQLSERVER) service is started. Click Start, click Administrative Tools, click Services, and scroll to SQL Server (MSSQLSERVER). If it is not started, right-click the service, select Properties, in Startup Type select Automatic, click Apply, click Start, and then click OK. Make sure service started. If service did not start - you need to analyze event log. Alternatively - try reinstalling/repairing SQL server.

  3. Make sure you have no network problems - try temporary disabling any firewalls(including Windows Firewall) and antiviruses.

  4. If service is started and firewalls disabled but still no luck - time to check SQL Server Configuration Manager settings. In detail it is described here and here. Shortly I would recommend first enable all protocols in both server and client sections. Reboot. Check it works. If that would not help - then try disabling everything apart from TCP/IP (both server and client sections). Reboot again.

If above does not help - try reinstalling SQL Server. Just make sure you have saved your databases 1st. To save them - stop sql server service, and copy your *.mdf and *.ldf (from SQL server Data folder) files to safe location. Later on you can attach them. If you are not sure where your SQL server Data folder located - just search for files with mdf extension.

Edit: Successful telnet showing SQL server port is up looks this way: start telnet connected successfully

Edit2:

Launch Event Viewer:

Launch Event Viewer

Click System, then Filter Current Log: Click System, then Filter Current Log

Setup filter as shown below: Setup filter

Then look for SQL-related events: enter image description here

Usually event text provides information why MSSQLSERVER service fails to start. If the text is unclear please google it for more details.

0
votes

If your problem was the same as mine (or to anyone else whose attempting to connect to their MS SQL Server w/ a similar connection string), MSSQLSERVER is the default instance name when you set it up, if you don't provide an instance name. I omitted the MSSQLSERVER from the connection string and I was successfully able to connect.

-2
votes

With all respect to "Anton Kruglov" and "marc_s" , Unfortunately, my problem is not resolved . I had to change my windows and reinstall softwares . Now it works properly .