Open In App

How to Install SQL Server Express in Linux?

Last Updated : 22 Mar, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Microsoft SQL Server Express is a feature-limited edition of Microsoft’s  SQL Server relational database management which is free to download, distribute, and use. It is used for creating or developing small-scale applications. It has been published since the SQL Server 2005. Microsoft provides it for educational purposes. This edition is used by Students, hobbyists, and startups to develop projects that do not require advanced features of SQL Server. It can also be used for any production database that is sized at or below the current SQL server. It has 10 GB of maximum database size and other important limits. In this article, we will learn how to install SQL Server Express in Linux.

Installing SQL Server Express in Linux

Follow the below steps to install SQL Server Express on ubuntu:

Step 1: Import the public repository GPG keys:

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

 Import-the-public-repository-GPG-keys

Step 2: Add MS-SQL Server repository:

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

Add-MS-SQL-Server-repository

Step 3: Install the Server using the following commands.

sudo apt update && sudo apt install -y mssql-server

Install-the-Server

Installing required packages…

Installing-required-packages

Step 4: Configure the Server using the following command:

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

While configuring the Server, choose ” 3 “ to install SQL Express Server as shown below and set up an administrator password.

Configure-the-Server

Step 5: Verify that the server is running:

Verifying-the-state-of-the-server

Step 6: Install the SQL Server command-line tools. So first we add tools repository using the following command:

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

Adding-tools-repository

Now Install the required CLI tools:

sudo apt update && sudo apt install -y mssql-tools unixodbc-dev

Installing-SQL-CLI-tools

Now we make a symbolic link of sqlcmd  in /usr/local/bin :

sudo ln -s /opt/mssql-tools/bin/sqlcmd /usr/local/bin

Adding-a-symbolic-link

At this point your installation is successful.

Create a new Database

Step 1: Connect locally to your MS SQL Express Server as the user SA:

sqlcmd -S localhost -U SA

Connecting-to-Server

Step 2: Create a database:

CREATE DATABASE <database name>

GO

Creating-a-Database

Step 3: Verify the database creation:

SELECT name FROM sys.databases

GO

Verify-the-database-creation

Note: To execute a command properly or commit a transaction, you must type GO on a new line to execute previous commands.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads