Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server
Azure SQL Database
Azure Synapse Analytics
Important
mssql-cli is deprecated. We recommend that you use sqlcmd (Go) instead. For more information, see sqlcmd utility.
mssql-cli is an interactive command-line tool for querying SQL Server and runs on Windows, macOS, or Linux.
Install mssql-cli
For detailed installation instructions, see the Installation guide. The most common install scenarios are summarized in the following sections.
Windows and macOS installation
mssql-cli is installed on Windows and macOS using pip:
pip install mssql-cli
For more detailed instructions, see the Installation guide.
Linux installation
After you register the Microsoft repository, mssql-cli can be installed and upgraded through package managers on several Linux distributions.
The following example applies to Ubuntu 18.04 (Bionic), more information and examples for other distributions can be found in the Installation guide.
Import the public repository GPG keys:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.ascRegister the Microsoft Ubuntu repository:
sudo apt-add-repository https://packages.microsoft.com/ubuntu/18.04/prodUpdate the list of products:
sudo apt-get updateInstall mssql-cli:
sudo apt-get install mssql-cliInstall missing dependencies:
sudo apt-get install -f
mssql-cli documentation
Documentation for mssql-cli is located in the mssql-cli GitHub repository.