There are over 5 billion unique mobile users globally. Your mobile phone contains your personal files, images, important banking applications, social media accounts, work files, and whatnot. If someone gets hold of your smartphone or remotely hacks it – it is like losing your digital identity. To prevent the loss of data from your mobile devices, a few preventive measures are recommended.

Update Ubuntu System

Please check all system packages are updated before adding any new packages

  • $ sudo apt-get update
  • $ sudo apt-get -y upgrade

If your system update Done

Import the public repository GPG keys:

Before installation Add GPG key for the system to trust MS SQL apt repository packages:

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

Install MS SQL Server 2019

Now run in terminal following commands to install SQL

  • $ sudo apt update
  • $ sudo apt install mssql-server

Press the y key to start the installation of Microsoft SQL Server 2019

Initialize MS SQL Server 2019

When the installation is done, proceed to set root user password by running initial

  • $ Sudo/opt/mssql/bin/mssql-conf setup

Select Your Required Mode and Give Permission

Check The MS SQL service should be started or not

  • $ systemctl status mssql-server.service

Install MS SQL tools and unixODBC plugin

  • curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add
  • curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
  • sudo apt update
  • sudo ACCEPT_EULA=Y apt install mssql-tools unixodbc-dev

Configure PATH for MS SQL binaries

Add /opt/mssql-tools/bin/ to your PATH environment variable in a bash shell

To make sqlcmd/bcp accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile file with the following command:

  • echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
  • source ~/.bash_profile

To make sqlcmd/bcp accessible from the bash shell for interactive/non-login sessions, modify the PATH in the ~/.bashrc file with the following command:

  • echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
  • source ~/.bashrc

Connect to MS SQL console

In Local

  • sqlcmd -S localhost -U SA -P '<-YourPassword->'

onIp address

  • sqlcmd -S 192.168.1.1 -U SA -P ' <-YourPassword->'

Create a new database

  • CREATE DATABASE PMDB
  • SELECT Name from sys.Databases
  • GO

Insert data

  • USE PMDB
  • CREATE TABLE classroom (id INT, Classname NVARCHAR(50), Roomno INT)
  • INSERT INTO classroom VALUES (1, 'Shivaji', 150); INSERT INTO Inventory VALUES (2, 'Laxmi', 154);
  • GO

Select data

  • SELECT * FROM classroom WHERE Roomno> 152;