Installing Microsoft SQL Server on Windows is quite easy (now I will call it with the familiar name SQL Server for a brief and more familiar look). You just need to download SQL Server Management Studio (SSMS) and install it will automatically install what is needed for you without you needing to do anything more. However, on Ubuntu wanting to use SQL Server is a bit more complicated.
SQL Server Management Studio (SSMS) is a tool exclusively for Windows operating systems. If you use MacOS or Ubuntu want or force to use SQL Server for study or work and do not want to use the command line to run SQL statements, you must use either of the following tools: Azure Data Studio or install the mssql extension on VS Code. Today, I will guide you to install and use Azure Data Studio on Ubuntu.
First, you download the .deb file of Azure Data Studio at: https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql- server-linux-2017
You click download .deb in the platform for Linux as shown above, the browser will automatically download an installation file.
Open termial and then use cd command to go to the directory where the installation file is downloaded (or you can go to the directory where the installation file is located and then right-click and select open terminal).
Install the software with the following command:
sudo dpkg -i azuredatastudio-linux-<version string>.deb
<version string> with the corresponding table session you downloaded or just press
sudo dpkg -i azu and click tab, the computer will automatically suggest the installation file for you).
Wait after the installation is complete you use the
azuredatastudio command to open Azure Data Studio. However, that is not done yet. You have just installed a visualization software that helps you better handle queries using the UI tool without having to use the command line. Now you must install SQL Server and then connect Azure Data Studio with SQL Server.
To download SQL Server, do the following, open a terminal using the following commands:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2017.list)"
sudo apt-get update
sudo apt-get install -y mssql-server
After the installation is complete, you reconfigure SQL Server with the following command (everything is very simple, you can choose Y, but remember to pay attention to the password, the password must be uppercase, lowercase letters. , numbers and special characters. And more importantly, you must remember this password to be able to connect to the server)
sudo /opt/mssql/bin/mssql-conf setup
After the installation is complete, use the following command to check, if it shows up as shown below, you have successfully installed SQL Server and then:
systemctl status mssql-server.service
Now it’s a SQL Server connection to Azure Data Studio. Open Azure Data Studio, click on the new connection on the Welcome window or click on the green add connection on the left. A connection window appears for you to enter information.
You leave the server information as localhost, the default User name is sa, and the password is the password you just set when configuring. Everything is left to default, then press Connect.
OK! now you use it normally like any other tool. You can create databases, tables, or columns using the UI tool or with query commands like SQL Server Management Studio. The window after successful connection will look like this: