This topic shows how to use SQL Server Management Studio (SSMS) to connect to SQL Server 2017 on Linux. SSMS is a Windows application, so use SSMS when you have a Windows machine that can connect to a remote SQL Server instance on Linux.
After successfully connecting, you run a simple Transact-SQL (T-SQL) query to verify communication with the database.
Install the newest version of SQL Server Management Studio
When working with SQL Server, you should always use the most recent version of SQL Server Management Studio (SSMS). The latest version of SSMS is continually updated and optimized and currently works with SQL Server 2017 on Linux. To download and install the latest version, see Download SQL Server Management Studio. To stay up-to-date, the latest version of SSMS prompts you when there is a new version available to download.
Connect to SQL Server on Linux
The following steps show how to connect to SQL Server 2017 on Linux with SSMS.
- Start SSMS by typing Microsoft SQL Server Management Studioin the Windows search box, and then click the desktop app.
- In the Connect to Serverwindow, enter the following information (if SSMS is already running, click Connect > Database Engine to open the Connect to Server window):
Setting Description Server type The default is database engine; do not change this value. Server name Enter the name of the target Linux SQL Server machine or its IP address. Authentication For SQL Server 2017 on Linux, use SQL Server Authentication. Login Enter the name of a user with access to a database on the server (for example, the default SA account created during setup). Password Enter the password for the specified user (for the SA account, you created this during setup).
- Click Connect.
- After successfully connecting to your SQL Sever, Object Explorer opens and you can now access your database to perform administrative tasks or query data.
Run sample queries
After you connect to your server, you can connect to a database and run a sample query. If you are new to writing queries, see Writing Transact-SQL Statements.
- Identify a database to use to run a query against. This could be a new database you created in the Transact-SQL tutorial. Or it could be the AdventureWorks sample database that you downloaded and restored.
- In Object Explorer, navigate to the target database on the server.
Right-click the database and then select New Query:
n the query window, write a Transact-SQL query to select data from one of the tables. The following example selects data from the Production.Product table of the AdventureWorks database.
SELECT TOP 10 Name, ProductNumber FROM Production.Product ORDER BY Name ASC
- Click the Execute button: