Install SQL Server command-line tools
Seffu Kioi Nyambura
Posted on April 26, 2022
After successful installation of SQL Server in ubuntu, we need a way to access it trough the terminal. This post illustrates steps you can take to make this possible
Prerequisites:
- Account with sudo privileges
- Successful installation of SQL Server in Ubuntu
Procedure:
Step 1: Open terminal
Use the shortcut Ctrl + alt + t to open the terminal
Step 2: Update and install curl (Optional)
sudo apt update && sudo apt install curl
Step 3: Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Step 4: Register the Microsoft Ubuntu repository
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
Step 5: Update the sources list and install mssql-tools and odbc drivers
sudo apt update
sudo apt install mssql-tools unixodbc-dev
Step 6: Add mssql-tools to your PATH environment variable
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
Step 7: Connect local
Replace 'YourPassword' with the password you set during installation
sqlcmd -S localhost -U SA -P '<YourPassword>'
Congratulations you can now access mssql server in ubuntu
Posted on April 26, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.