SQL server Linux and SQLCMD

Following on from a previous blog post (https://blobeater.blog/2021/01/15/sql-server-linux/) on installing SQL Linux, a common requirement will be the need to connect to it to issue queries, typically via SQLCMD). There isn’t too much to it but still an important step.

This example was for my Red Hat variant.

Enter super user

sudo su

Download the Microsoft Red Hat repository configuration file.

curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/msprod.repo

Exit super user

exit

Install mssql-tools with the unixODBC developer package

sudo yum install mssql-tools unixODBC-devel

A little thing here, if you used an Azure VM that has a linux image of SQL already installed you will need to change sa password to connect.

sudo systemctl stop mssql-server

sudo /opt/mssql/bin/mssql-conf set-sa-password

Then you can issue SQL commands.

Advertisement

4 thoughts on “SQL server Linux and SQLCMD

  1. Pingback: SQL server Linux and SQLCMD from Blog Posts – SQLServerCentral - The web development company

  2. Pingback: Dew Drop – January 25, 2021 (#3366) – Morning Dew by Alvin Ashcraft

  3. Pingback: CodersEditor Daily – 25 January 2021 - CodersEditor.com

  4. Pingback: SQL server Linux and SQLCMD from Blog Posts – SQLServerCentral – Demo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s