| title | Lesson 1: Connecting to the Database Engine | Microsoft Docs |
|---|---|
| ms.custom | |
| ms.date | 02/05/2018 |
| ms.prod | sql |
| ms.prod_service | database-engine |
| ms.reviewer | |
| ms.technology | |
| ms.topic | quickstart |
| ms.assetid | e8db82f0-50ed-4531-9209-940006ed34cb |
| author | MashaMSFT |
| ms.author | mathoma |
[!INCLUDEappliesto-ss-xxxx-xxxx-xxx-md]
When you install the [!INCLUDEssDEnoversion], the tools that are installed depend upon the edition and your setup choices. This lesson reviews the principal tools, and shows you how to connect and perform a basic function (authorizing more users).
This lesson contains the following tasks:
- The [!INCLUDEssDEnoversion] ships with a variety of tools. This topic describes the first tools you will need, and helps you select the right tool for the job. All tools can be accessed from the Start menu. Some tools, such as [!INCLUDEssManStudioFull], are not installed by default. You must select the tools as part of the client components during setup. For a complete description of the tools described below, search for them in [!INCLUDEssNoVersion] Books Online. [!INCLUDEssExpress] contains only a subset of the tools.
-
[!INCLUDEssManStudioFull] (SSMS) is the principal tool for administering the [!INCLUDEssDE] and writing [!INCLUDEtsql] code. It is hosted in the [!INCLUDEvsprvs] shell. SSMS is available as a free download from Microsoft Download Center. The latest version can be used with older versions of the [!INCLUDEssDE_md].
-
[!INCLUDEssNoVersion] Configuration Manager installs with both [!INCLUDEssNoVersion] and the client tools. It lets you enable server protocols, configure protocol options such as TCP ports, configure server services to start automatically, and configure client computers to connect in your preferred manner. This tool configures the more advanced connectivity elements but does not enable features.
The sample databases and samples are not included with [!INCLUDEssNoVersion]. Most of the examples that are described in [!INCLUDEssNoVersion] Books Online use the [!INCLUDEssSampleDBobject] sample database.
- On current versions of Windows, on the Start page, type SSMS, and then click Microsoft SQL Server Management Studio.
- When using older versions of Windows, on the Start menu, point to All Programs, point to [!INCLUDEssCurrentUI], and then click SQL Server Management Studio.
- On current versions of Windows, on the Start page, type Configuration Manager, and then click SQL Server version Configuration Manager.
- When using older versions of Windows, on the Start menu, point to All Programs, point to [!INCLUDEssCurrentUI], point to Configuration Tools, and then click SQL Server Configuration Manager.
- It is easy to connect to the [!INCLUDEssDE] from tools that are running on the same computer if you know the name of the instance, and if you are connecting as a member of the local Administrators group on the computer. The following procedures must be performed on the same computer that hosts [!INCLUDEssNoVersion].
Note
This topic discusses connecting to an on-premises SQL Server. To connect to Azure SQL Database, see Connect to SQL Database with SQL Server Management Studio and execute a sample T-SQL query.
- Log into Windows as a member of the Administrators group, and open [!INCLUDEssManStudio].
- In the Connect to Server dialog box, click Cancel.
- If Registered Servers is not displayed, on the View menu, click Registered Servers.
- With Database Engine selected on the Registered Servers toolbar, expand Database Engine, right-click Local Server Groups, point to Tasks, and then click Register Local Servers. Expand Local Server Groups to see all the instances of the [!INCLUDEssDE] installed on the computer displayed. The default instance is unnamed and is shown as the computer name. A named instance displays as the computer name followed by a backward slash (\) and then the name of the instance. For [!INCLUDEssExpress], the instance is named <computer_name>\sqlexpress unless the name was changed during setup.
-
In Registered Servers, if the name of your instance of [!INCLUDEssNoVersion] has a green dot with a white arrow next to the name, the [!INCLUDEssDE] is running and no further action is necessary.
-
If the name of your instance of [!INCLUDEssNoVersion] has a red dot with a white square next to the name, the [!INCLUDEssDE] is stopped. Right-click the name of the [!INCLUDEssDE], click Service Control, and then click Start. After a confirmation dialog box, the [!INCLUDEssDE] should start and the circle should turn green with a white arrow.
At least one administrator account was selected when [!INCLUDEssNoVersion_md] was being installed. Perform the following step while logged into Windows as an administrator.
- In [!INCLUDEssManStudio], on the File menu, click Connect Object Explorer.
- The Connect to Server dialog box opens. The Server type box displays the type of component that was last used.
- Select Database Engine.
- In the Server name box, type the name of the instance of the [!INCLUDEssDE]. For the default instance of SQL Server, the server name is the computer name. For a named instance of SQL Server, the server name is the <computer_name>\<instance_name>, such as ACCTG_SRVR\SQLEXPRESS. The following screenshot shows connecting to the default (un-named) instance of [!INCLUDEssNoVersion_md] on a computer named 'PracticeComputer'. The user logged into Windows is Mary from the Contoso domain. When using Windows Authentication you cannot change the user name.
- Click Connect.
Note
This tutorial assumes you are new to [!INCLUDEssNoVersion] and have no special problems connecting. This should be sufficient for most people and this keeps this tutorial simple. For detailed troubleshooting steps, see Troubleshooting Connecting to the SQL Server Database Engine.
Now that you have connected to [!INCLUDEssNoVersion] as an administrator, one of your first tasks is to authorize other users to connect. You do this by creating a login and authorizing that login to access a database as a user. Logins can be either Windows Authentication logins, which use credentials from Windows, or SQL Server Authentication logins, which store the authentication information in [!INCLUDEssNoVersion] and are independent of your Windows credentials. Use Windows Authentication whenever possible.
Tip
Most organizations have domain users and will use Windows Authentication. You can experiment on your own, by creating additional local users on your computer. Local users will be authenticated by your computer, so the domain is the computer name. For example if your computer is named MyComputer and you create a user named Test, then the Windows description of the user is Mycomputer\Test.
-
In the previous task, you connected to the [!INCLUDEssDE] using [!INCLUDEssManStudio]. In Object Explorer, expand your server instance, expand Security, right-click Logins, and then click New Login. The Login - New dialog box appears.
-
On the General page, in the Login name box, type a Windows login in the format:
<domain>\\<login>
- In the Default database box, select [!INCLUDEssSampleDBobject] if available. Otherwise select master.
- On the Server Roles page, if the new login is to be an administrator, click sysadmin, otherwise leave this blank.
- On the User Mapping page, select Map for the [!INCLUDEssSampleDBobject] database if it is available. Otherwise select master. Note that the User box is populated with the login. When closed, the dialog box will create this user in the database.
- In the Default Schema box, type dbo to map the login to the database owner schema.
- Accept the default settings for the Securables and Status boxes and click OK to create the login.
Important
This is basic information to get you started. [!INCLUDEssNoVersion] provides a rich security environment, and security is obviously an important aspect of database operations.


