Products & Services Submit a ticket My Tickets
Selamat datang
Masuk  Mendaftar

How to Access MSSQL with MSSQL Management Studio

SQL Server Management Studio (SSMS) is the principal tool for administering the Database Engine and writing Transact-SQL code. It is hosted in the Visual Studio shell. 


SSMS is available as a free download from Microsoft Download Center. The latest version can be used with older versions of the Database Engine.
https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?redirectedfrom=MSDN&view=sql-server-ver15 


To start SQL Server Management Studio


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 Microsoft SQL Server, and then click SQL Server Management Studio.


Connecting with Management Studio


It is easy to connect to the Database Engine 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 SQL Server.


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.

https://docs.microsoft.com/en-us/azure/azure-sql/database/connect-query-ssms


To determine the name of the instance of the Database Engine


1.    Log into Windows as a member of the Administrators group, and open Management Studio.

2.    In the Connect to Server dialog box, click Cancel.

3.    If Registered Servers is not displayed, on the View menu, click Registered Servers.

4.    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 Database Engine 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 SQL Server Express, the instance is named <computer_name>\sqlexpress unless the name was changed during setup.


To verify that the Database Engine is running


1.    In Registered Servers, if the name of your instance of SQL Server has a green dot with a white arrow next to the name, the Database Engine is running and no further action is necessary.


2.    If the name of your instance of SQL Server has a red dot with a white square next to the name, the Database Engine is stopped. Right-click the name of the Database Engine, click Service Control, and then click Start. After a confirmation dialog box, the Database Engine should start and the circle should turn green with a white arrow.


To connect to the Database Engine


At least one administrator account was selected when SQL Server was being installed. Perform the following step while logged into Windows as an administrator.


1.    In Management Studio, 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.


2.    Select Database Engine.


3.    In the Server name box, type the name of the instance of the Database Engine. 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 SQL Server 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.


4.    Click Connect. 


Note

This tutorial assumes you are new to SQL Server 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.

https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/troubleshoot-connecting-to-the-sql-server-database-engine?view=sql-server-ver15


Authorizing Additional Connections


Now that you have connected to SQL Server 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 SQL Server 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.


Create a Windows Authentication login

  1. In the previous task, you connected to the Database Engine using Management Studio. In Object Explorer, expand your server instance, expand Security, right-click Logins, and then click New Login. The Login - New dialog box appears.

  2. On the General page, in the Login name box, type a Windows login in the format: <domain>\\<login>

  1. In the Default database box, select AdventureWorks2012 if available. Otherwise select master.
  2. On the Server Roles page, if the new login is to be an administrator, click sysadmin, otherwise leave this blank.
  3. On the User Mapping page, select Map for the AdventureWorks2012 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.
  4. In the Default Schema box, type dbo to map the login to the database owner schema.
  5. Accept the default settings for the Securables and Status boxes and click OK to create the login.

Apakah jawaban ini bermanfaat? Ya Tidak

Send feedback
Maaf kami tidak bisa membantu. Bantu kami mengembangkan artikel ini dengan umpan balik Anda.