SQL Server Express – Difference Between Connecting to localhost and localhost\sqlexpress

sql-server-expressssms

I am new to SQL Server and am following some tutorials.

I have not yet created any databases. In SQL Server 2012 Management Studio I click on "connect" -> "Database Engine". I noticed that, using the server name field, I can type localhost and then connect or localhost\sqlexpress and it also connects successfully.

I don't understand what the difference is, and practically what the impact would be to using one over the other. Could somebody please provide an explanation?

In the image below you can see I am connected to both at the same time. One has databases and one does not. What is the difference between these two instances? Why does one have the databases I created and the other does not?

screenshot

Best Answer

Hypothesis one: You have installed a named instance called SQLExpress. This instance was configured to listen on the default SQL Server port 1433. Therefore wether you connect to 'localhost' or to 'localhost\SQLExpress', you are connecting to the same instance.

Hypothesis two: You have installed two different SQL Server instances, one named SQLExpress and one default, unnamed. Both connections succeed, but you are not connecting to the same instance.