Before 2017, Microsoft had not made its famous manager compatible with distributors like Linus. However, since that time, this operation is quite possible provided that you master a few steps. From this guide, you will learn about the command lines that will help you install SQL Server on Linux.
Install SQL Server
This step is the first. If you already have an SQL Server, you can go directly to the next step. First, you must start by opening an SSH terminal or remote connection. This allows you to download the GPG keys from the repository on Microsoft’s public platform. Once the keys have been obtained, you must check the latest available packages before downloading the SQL Server software from the official repositories.
Then you need to run the command. It will allow you to know the version you are going to install and will specify the password of the SA account. You will have to state your identity by choosing your profession and then your language. To ensure the security of your software, it is strongly recommended that you define an SA administrator password.
Finally, as soon as you finish with the identification, you should verify that the MSSQL Server service is running.
Install SQL Server Linux Administration Tools
To install the SQL server administration tools, you will start by adding a repository. The latter should be offered to you by the server on which you opened the terminal. Once executed, you should run an update before installing Unix ODBC.
If you have passed these steps correctly, you will see a new screen in a different color with an overview of the license agreement. You will need to answer yes to proceed to the next step.
However, there are PATH environment variables that can simplify the use of commands.
Connect to SQL Server Linux with SQL cmd
The third step in installing an SQL Server on Linux involves establishing the connection between these two networks. There are online elements that allow direct attachment to the SQL server such as the SQL Cmd tool.
You can sign in to Microsoft on-premises using any of these default sign-in commands. Usually these are:
- sqlcmd – S localhost – U SA – P “==”
- –S: SQL Server name (localhost = local)
- – U: username, the username (by default “sa” has been configured)
- – P: password / password (the one defined previously)
When it is a remote connection, the command will become:
- sqlcmd – S sqlubuntu – U SA – P M0tDeP @ sse
Edit a database from the command line
To create a database from the command line, you just need to go through a few steps.
- Edit the following query to create a database under the name Windowsfacile: CREATE DATABASE Windowsfacile.
- Check the BDD list with the command: SELECT Name from sys.Databases.
Each order must be followed by a “GO” line. Otherwise, the query will not be executed. If you follow each step, you will receive your result containing the stockings by default. To quit the SGL Cmd tool, just press quit.
Once you exit this view, you will be able to connect to SQL Server on Linux from Windows.