In the last article I have gone through the process of installing SQL Server on a Linux machine and connecting to the instance via SQL Management Studio.
Of course SQL Server on Linux comes with a set of command-line tools and ODBC drivers that you can use for managing SQL and database instances, in this article I will show how to install SQL Server tools on Linux.
Install SQL Server Tools on Linux
SQL Server Tools that are available under Linux are
- sqlcmd Command-line query utility
- bcp Bulk import-export utility
Like in the previous post I will be using an Ubuntu 16.04 machine to carry on all examples.
Connect to the Linux server via SSH, run
sudo su - and import SQL Server Tools repository key via the following command
Run the following command to register the repository itself
Next update repository metadata with the following command
Finally issue the
sudo apt-get install mssql-tools to install tools’ binaries (text will scroll as there is a good number of packages that will be downloaded)
Once SQL Server Tools have been installed you can connect to the local instance with the following command
sqlcmd -S localhost -U SA -P '' omitting the -P switch you will be prompted for a password
Congratulations now you can query, manage and create databases on your Linux SQL Server.
Of course managing databases or SQL Statements is out the article scope but this can be a good starting point.