Question

My desktop machine has SQL Server installed. I can connect to it (using my desktop machine) using the following server name:

localhost\SQL_Express
Windows Authentication

If I want to connect to it using my Laptop, I try to do the following (ACER_ASPIRE is my computer name):

ACER_ASPIRE\SQL_Express
SQL Authentication (acerAspireUserName, acerAspirePassword)

I get an error saying the server wasn't found. How can I go about connecting to my desktop machine's SQL Server from my Laptop?

Was it helpful?

Solution

To connect to a Sql Server you need to specify two things.

1 - Server name

In this section you are suppose to provide [ServerName\InstanceName]

Server Name is the Machine Name where your sql server Instance lives. And obviously since sql server can have multiple instances on one machine you need to provide the instance name that you want to connect to.

There is an exception for Instance name if you are connecting to the Default Instance you dont need to provide full [ServerName\InstanceName] you can only use the machine name to connect to the default instance on sql server on that machine.

One thing you need to know is

localhost == . == MachineName == ServerName

These are all different ways you can tell sql server , the server name that you want to connect to.

2 - Authentication

You have two ways to authenticate yourself when connecting to sql server,

  1. Windows Authentication.
  2. Sql Server Authentication.

In 1st section ServerName you told sql server that which machine and what instance you want to connect to.

Now in this Authentication Section you will have to tell sql server how you will be Authenticated.

When using Windows Authentication Sql server will use your windows credentials to identify you. This has nothing to do with the Server/Machine name it is to do with the Operation system of the machine, in your case it is windows and you can use your windows credentials.

On the other hand if you use Sql Server Authentication you will have to use a Sql Server Login' andPassword`. In this case sql server will not care what operating system you have on your machine. (mostly used when you are working on operation systems other than windows like Linux, Unix, Mac). It will only take consideration the login and password you pass.

Authentication Mode

What Authentication Mode you can use? this depends on your sql server configuration when you were installing, You can set your sql server to Only Allow Windows Authentication or Mixed Mode (i.e Windows Authentication and Sql Server Authentication).

Your Case

In your Case regardless of what Authentication Mode you are using. You can use any notations in sql server SERVER Section as long as they point to your machine like

local, localhost, . , ACER_ASPIRE

But for Authentication if you are using Sql Server Authentication Make sure you are using a Valid Sql Server Login and Password.

OTHER TIPS

Open the query window, and inside it execute the following:

EXEC sys.sp_configure N'remote access', N'1'
GO
RECONFIGURE WITH OVERRIDE
GO

This option is not enabled by defauld on Express edition.

By default, SQL Express doesn't support LAN Connections, only from local machine. To use it you must configure to listen to network ports also. You can do that on the SQL Server Surface configuration tool.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top