32

I was just given a laptop to perform some development from a client and I am currently in the process of setting it up. Visual Studio 2010 is installed as well as SQL Server Management Studio 2008 R2. I'm trying to open SQL Server Management Studio to connect to the database but so far am not having much luck. I'm used typing in for a server name something like...

localhost
(local)
SQLEXPRESS

None of these are working.

So my question is: How can I tell what type of SQL Server installation and configuration I have on this machine, and how can I discover what server name I need to use in order to properly connect to it?

--Addition--------------------------------------------

I looked into the services as directed and found a few instances as indicated. SQLEXPRESS and MSSQLSERVER. I have tried to login with both of those options in these configurations...

SQLEXPRESS
MSSQLSERVER
computername\SQLEXPRESS
computername\MSSQLSERVER
.\SQLEXPRESS
.\MSSQLSERVER

None of these worked. I also altered the 'Log On As' property of the services from 'Network Service' to 'Local System' and tried them again. Still no success.

Damien_The_Unbeliever
  • 234,701
  • 27
  • 340
  • 448
jdavis
  • 8,255
  • 14
  • 54
  • 62
  • 3
    Try .\SQLEXPRESS - its an instance name – StuartLC Jul 11 '12 at 03:55
  • You are using management studio locally right? Not through the network? – sam yi Jul 11 '12 at 14:40
  • On my corporate laptop, as our user account isnt an admin account but we are given a admin username to use when needing to install things, I had to run SQL management studio with the admin account - then as that user I also created myself an account as "SA" user was disabled by default. and this did work for me "computername\SQLEXPRESS" – JGlass Dec 18 '17 at 22:09
  • the year 2020. This is a MS product. Just does not work! – Blue Clouds Feb 04 '20 at 09:05

8 Answers8

24

Instead of giving:

./SQLEXPRESS //in the Server Name

I put this:

.\SQLEXPRESS //which solved my problem
Asif Mehmood
  • 964
  • 2
  • 14
  • 35
15

You should be able to see it in the Services panel. Look for a servicename like Sql Server (MSSQLSERVER). The name in the parentheses is your instance name.

dpw
  • 1,576
  • 9
  • 14
8

If sql server is installed on your machine, you should check

Programs -> Microsoft SQL Server 20XX -> Configuration Tools -> SQL Server Configuration Manager -> SQL Server Services You'll see "SQL Server (MSSQLSERVER)"

Programs -> Microsoft SQL Server 20XX -> Configuration Tools -> SQL Server Configuration Manager -> SQL Server Network Configuration -> Protocols for MSSQLSERVER -> TCP/IP Make sure it's using port number 1433

If you want to see if the port is open and listening try this from your command prompt... telnet 127.0.0.1 1433

And yes, SQL Express installs use localhost\SQLEXPRESS as the instance name by default.

sam yi
  • 4,806
  • 1
  • 29
  • 40
  • Using telnet as you direct, I an error message saying: Connecting to 127.0.0.1...Could not open connection to the host, on port 1443: Connect failed. How do I configure this port to listen? – jdavis Jul 11 '12 at 05:13
  • 1
    Note that SQLExpress doesn't install with TCP/IP by default, and is locked down for remote access / firewall etc. See here on how to open this up : http://stackoverflow.com/questions/9138172/enable-tcp-ip-remote-connections-to-sql-server-express-already-installed-databas – StuartLC Jul 11 '12 at 06:29
  • I want to use it using 127.0.0.1\sqlexpress. is it possible ? – Kishan Gajjar Jun 20 '14 at 06:28
  • 3
    "localhost\SQLEXPRESS" as server name did the job for me! Thanks – Thylle Jun 15 '16 at 19:58
  • @Thylle I can confirm this as well, after installing SQL Server 2008 Express with all default settings, SQLEXPRESS as a server name never worked, but localhost\SQLEXPRESS did (using Windows Authentication). I guess I was confused as to whether the hostname was necessary in the server name or not. – jrh May 03 '17 at 13:56
6

Sometimes none of these would work for me. So I used to create a new web project in VS and select Authorization as "Individual User Accounts". I believe this work with some higher version of .NET Framework or something. But when you do this it will have your connection details. Mostly something like this

(LocalDb)\MSSQLLocalDB
Vivekh
  • 4,141
  • 11
  • 57
  • 102
5

by default -

you can also log in to sql express using server name as:

./SQLEXPRESS

or log in to sql server simply as

.
George
  • 6,006
  • 6
  • 48
  • 68
1

This was provided after installation of Sql Express 2019

Server=localhost\SQLEXPRESS;Database=master;Trusted_Connection=True;

So just use 'localhost\SQLEXPRESS' in server name and windows authentication worked for me.

enter image description here

Blue Clouds
  • 7,295
  • 4
  • 71
  • 112
  • thanks, that acually saved me. I was not able to display the connection string again after installing the software. – mffap Apr 05 '20 at 16:23
0

Similar to what StuartLC was saying, my problem was not resolved until I enabled TCP/IP protocol under SQL Network Configuration>>Protocols for MSSQLSERVER in the SQL Server Configuration Manager dialogue box. After enabling this and a restart, my SSMS connected right away with just the instance name (no ~\MSSQLSERVER).

Casivio
  • 333
  • 7
  • 15
0

All of the following services should be running,for successful connectivity: SQL Full test filter Daemon, SQL server(SQLEXPRESS), SQL Server Agent(SQLEXPRESS), SQL Server Browser, SQL server reporting service and SQL Server VSS Writer

salsinga
  • 1,957
  • 1
  • 14
  • 26