MS SQL Server
Overview
Microsoft SQL server is a database management system, with the primary function of storing and retrieving data as requested by other software applications.
Installing MS SQL
Windows
Go to the following website: SQL Server Downloads | Microsoft
Locate which edition you would like to download and click
Download Now
.
In this example, downloadSQL Server 2019 Developer
, a free full-featured edition to use as a development and test database in a non-production environment.If you encounter the following error when downloading,
A required file could not be downloaded. This could mean the version of the installer is no longer supported
, please do the following:Open Powershell as administrator
Run:
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type Dword Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type Dword
Retry to download and run the installer
Double-click and open the downloaded installation file.
Choose an installation type, specify the folder and click
Install
.Note: Choosing
Custom
allows for more customization for instance and user configuration.If you selected
Custom
, the following window appears after the installation completes. In the left-menu clickInstallation
. Then clickNew SQL Server stand-alone installation or add features to an existing installation
.Again, specify which SQL edition you wish to install.
Click
Next
to continue. You’ll pass a page namedInstall Rules
and it will test and execute rules.In the
Feature Selection
window, selectDatabase Engine Services
andSQL Client Connectivity SDK
. Then clickNext
.Specify the name and instance ID for the SQL server and click
Next
.Change to default service configuration so that
SQL Server Agent
andSQL Server Browser
have startup type set toAutomatic
. ClickNext
.In the
Database Engine Configuration
, choose theMixed Mode
authentication. Enter the password for the administrator (sa
) account and clickAdd current user
to add the host machine as an admin.After clicking
Next
, clickInstall
to start the installation process. Once complete, you should see something similar to the following:
You have now installed MS SQL Server.
See the following section below to install SSMS to interact with the server: <once published, insert link to SSMS section below>
Linux
MS SQL servers only supports the following platforms: RHEL, SLES, Ubuntu, and Docker.
Ubuntu 16.04 or 18.04
Import the public repository GPG keys.
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Install SQL Server 2017 or 2019.
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)"
If using Ubuntu 16.04, in line 2 replace
.../ubuntu/18.04/...
with.../ubuntu/16.04/...
.Update or install SQL Server.
Run the following to choose which edition to install.
You’ll be prompted choose which edition by typing the corresponding value from
[1-8]
.
Then, you’ll also be asked to input a password for theSQL Server system administrator
.To check the server is active, run the following command:
Install SQL Server command-line tools.
If using Ubuntu 16.04, in line 2 replace
.../ubuntu/18.04/...
with.../ubuntu/16.04/...
.Verify installation of
mssql-tools
and enable to your user profile.Connect by running the following command, where
servername
is the SQL server name (orlocalhost
for host connection) andsa
is the username.
Notes:sa
is the default admin username. For the default instance, the server name is the computer name or IP address.
Install MS SQL Service Management Studio
To interact with SQL servers, install SQL Server Management Studio (SSMS). It is a software for querying, designing and managing the server on your local computer or cloud.
SSMS supports Windows operating systems.
Under the section Download SSMS, click
Download SQL Server Management Studio
.Once the installation file is done downloading. double-click and open it.
Click
Install
in the Installer.Once it’s done, click
Close
.In the Windows search bar, type
ssms
and clickOpen
.In SSMS, type the
servername
of the SQL server, select theauthentication
method, and type the username and password.
In the example below, the server name islocalhost
(since the machine is the host) and authentication method isWindows
, so no further input was needed.Click
Connect
.
AutoStart SQL Server Agent on System Startup
Windows
On the host computer, in the Windows search bar, type
sql server 2019 configuration manager
and double-click to open.Click on
SQL Server Services
.Right-click on
SQL Server Agent
and clickProperties
.In the
Properties
window, click theService
Tab and changeStart Mode
toAutomatic
then clickOk
.
Linux (Ubuntu 16.04 or 18.04)
On the host computer, run the following command to check status and enable
autostart
:
Allow Remote Connections (Windows)
Enable protocols.
In the Windows search bar, type
sql server 2019 configuration manager
and double-click to open.In SQL Server Configuration Manager, expand
SQL Server Network Configuration
, and then clickProtocols for Instance Name
.The default instance (an unnamed instance) is listed as
MSSQLSERVER
. If you installed a named instance, the name you provided is listed.
Right-click
TCP/IP
, and then clickEnable
.
Configure a fixed port.
In SQL Server Configuration Manager, expand
SQL Server Network Configuration
, and then clickProtocols for Instance Name
.Double-click
TCP/IP
.In the
TCP/IP Properties
dialog box, click theIP Addresses
tab.In the
TCP Port
box of theIPAll
section, type1433
for a default instance or49172
for a named instance.Click
OK
to close the dialog box, and clickOK
to the warning that the service must be restarted.In the left pane, click
SQL Server Services
.Right-click
SQL Server (Instance name)
, and then clickRestart
.
Open ports in the firewall.
In the Windows Start menu, search and click
Run
, typeWF.msc
, and then clickOK
.In Windows Firewall with Advanced Security, in the left pane, right-click
Inbound Rules
, and then clickNew Rule
in the action pane.In the
Rule Type
dialog box, selectPort
, and then clickNext
.In the
Protocol and Ports
dialog box, selectTCP
. SelectSpecific local ports
, and then type the port number of the instance of the Database Engine. Type1433
for the default instance. Type49172
if you are configuring a named instance. ClickNext
.In the
Action
dialog box, selectAllow the connection
, and then clickNext
.In the
Profile
dialog box, select any profiles that describe the computer connection environment when you want to connect to the Database Engine, and then clickNext
.In the
Name
dialog box, type a name and description for this rule, and then clickFinish
.
Connecting from another computer.
On a second computer that contains the SQL Server client tools, log in with an account authorized to connect to SQL Server, and open Management Studio.
In the
Connect to Server
dialog box, confirmDatabase Engine
in theServer type
box.In the
Server name
box, typetcp:<computer name>,<port number>
.
To connect to the default instance, the port 1433 is implied; therefore, typetcp:<computer_name>
.
For a named instance, typetcp:<computer_name>,49172
.Note: If you omit
tcp:
from the Server name box, then the client will attempt all protocols that are enabled, in the order specified in the client configuration.Select the
authentication
method and inputuser name
andpassword
if prompted. Then clickConnect
.