fbpx

How to test connectivity to a Microsoft SQL database using the Linux command line

Here are some useful commands when working with Microsoft SQL and Linux, specifically pertaining to the `sqlcmd` mssql-cli utility.

Update 16 July 2021

It appears sqlcmd has been renamed and is now called mssql-cli.

Testing Connectivity using mssql-cli

The format for testing connectivity is:

mssql-cli -S ip_address_or_hostname -U user -P password

Testing Connectivity using `sqlcmd`

sqlcmd -S user.database.windows.net -U db_user -P db_password

View all Databases

1> select name from sys.databases
2> go

Select Records

1> select top 10 * from table_name order by id desc
2> go

References

Installation

Usage

Other

Share this article

Share on facebook
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top