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
Top comments (0)