Open In App

How to Install and Use MS SQL Server on Linux?

Improve
Improve
Like Article
Like
Save
Share
Report

Microsoft SQL Server is a relational database management system (RDBMS) that supports a broad range of transaction processing, business intelligence, and analytics applications. Along with Oracle Database and IBM’s DB2, Microsoft SQL Server is one of the three market-leading database technologies.

Microsoft SQL Server, like other RDBMS applications, is based on SQL, a structured programming language used by database administrators (DBAs) and other IT professionals to manage databases and query the information they hold. Transact-SQL (T-SQL), a Microsoft SQL implementation that applies a number of proprietary programming extensions to the regular language, is bound to SQL Server.

Installing MS SQL Server

Ensure that the most current software package is installed on the system. This will require you to update and upgrade your system.

$ sudo apt update && sudo apt upgrade

How to Install and Use MS SQL Server on Linux

Installing and upgrading system

Microsoft’s GPG key can be downloaded and installed:

$ sudo wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –

How to Install and Use MS SQL Server on Linux

Adding key

To install MSSQL server, add the official repository:

$ sudo add-apt-repository “$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-blockquoteview.list)”

How to Install and Use MS SQL Server on Linux

$ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

How to Install and Use MS SQL Server on Linux

Update the core package and additional resources by resynchronizing the package index files and updating the core package:

$ sudo apt-get update

How to Install and Use MS SQL Server on Linux

$ sudo apt-get install mssql-server mssql-tools unixodbc-dev -y

How to Install and Use MS SQL Server on Linux

As in the blockquotevious case, run the configuration script:

$ sudo /opt/mssql/bin/mssql-conf setup

How to Install and Use MS SQL Server on Linux

Select 2 for edition:

How to Install and Use MS SQL Server on Linux

Type Yes:

How to Install and Use MS SQL Server on Linux

Set password:

Now accept the license:

How to Install and Use MS SQL Server on Linux

How to use SQL Server

We’ll log in to the server and build the Fabrics database. The password you used when you first installed the package must be followed by the -P switch:

sqlcmd -S localhost -U SA -P ‘YourPassword’

How to Install and Use MS SQL Server on Linux

Create a database with your blockquoteferred name:

create database testdb

How to Install and Use MS SQL Server on Linux

Then type go:

go

How to Install and Use MS SQL Server on Linux

Now you can exit:

exit

How to Install and Use MS SQL Server on Linux


Last Updated : 06 Oct, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads