- Import the public repository GPG keys.
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
- Register the Microsoft repository.
wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list | sudo tee /etc/apt/sources.list.d/msprod.list
- Update the sources list and run the installation command with the unixODBC developer package.
For more information, see
sudo apt-get update
sudo apt-get install mssql-server
sudo apt-get install mssql-tools unixodbc-dev
-After the package installation finishes, run mssql-conf setup and follow the prompts to set the SA password and choose your edition.
sudo /opt/mssql/bin/mssql-conf setup
- Optional: Add
/opt/mssql-tools/bin/
to your PATH environment variable in a bash shell.
To make sqlcmd/bcp
accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile
or ~/.zshrc
file with the following command:
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
# if your using ZSH Shell use this
# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.zshrc
source ~/.zshrc
- Confirm SQL Server is running
systemctl status mssql-server --no-pager
# Service should be active
- Run
sqlcmd
with parameters for your SQL Server name (-S), the user name (-U), and the password (-P). In this tutorial, you are connecting locally, so the server name islocalhost
. The user name is SA and the password is the one you provided for the SA account during setup. - SA stand for System Administrator
You can omit the password on the command line to be prompted to enter it.
sqlcmd -S localhost -U SA -P '<YourPassword>'
Thank you so much for writing these steps, detailing on "how to install the SQL Server command line tools" on Debian.