How to Install SQL Server on Windows Server 2022
Microsoft SQL Server is one of the most widely deployed relational database management systems in enterprise environments. Installing SQL Server on Windows Server 2022 involves selecting the correct edition for your workload, preparing the server, running the installer, and validating the installation. This guide walks through the complete process from download to first connection.
SQL Server Editions Overview
SQL Server 2022 is available in several editions, each targeting a different use case and budget. Understanding which edition suits your environment is the first decision to make before installation.
Express is the free entry-level edition with a 10 GB database size limit per database and no SQL Server Agent. It is suitable for small applications, learning, and development. Developer includes all Enterprise features and is free for non-production development and testing. Standard supports up to 24 cores or 4 sockets (whichever is lower) and 128 GB of RAM per instance. It includes the SQL Server Agent, basic high availability, and replication. Enterprise has no core or memory cap (subject to OS limits), supports Always On Availability Groups with up to eight secondaries, In-Memory OLTP, columnstore indexes at full scale, and advanced analytics. Web is a low-cost edition licensed only for hosting and web-facing workloads.
For most production environments, Standard or Enterprise is the appropriate choice. Developer is ideal for development VMs where you want full feature parity with Enterprise at no cost.
Prerequisites
Before running the SQL Server installer, verify and configure the following on Windows Server 2022.
SQL Server 2022 requires .NET Framework 4.7.2 or later. Windows Server 2022 ships with .NET Framework 4.8, so this requirement is already met. You should also ensure Windows is fully patched. Open an elevated PowerShell prompt and run:
Install-WindowsUpdate -AcceptAll -AutoReboot
Verify that Windows Firewall, antivirus exclusions for SQL Server directories, and disk configuration are ready before installation. SQL Server data files (.mdf), log files (.ldf), and TempDB should ideally reside on separate volumes. For production, use dedicated storage per file type to reduce I/O contention.
Create dedicated Windows service accounts before installation. SQL Server allows you to use virtual accounts (NT ServiceMSSQLSERVER) or managed service accounts (MSA). For standalone installations, virtual accounts are the default and recommended approach. For clustered or domain-joined environments requiring Kerberos delegation, dedicated domain service accounts are required.
Unattended Installation Using a Configuration File
For repeatable, auditable installs, the recommended method is an unattended installation driven by a configuration file. This eliminates interactive prompts and allows you to version-control your install parameters.
First, generate a configuration file template by running the installer interactively up to the review screen, then copying the configuration file it produces. Alternatively, create one manually. A minimal configuration file for a default instance looks like this:
[OPTIONS]
ACTION="Install"
QUIET="True"
QUIETSIMPLE="False"
IACCEPTSQLSERVERLICENSETERMS="True"
FEATURES=SQLENGINE,SSMS
INSTANCENAME="MSSQLSERVER"
INSTANCEDIR="C:Program FilesMicrosoft SQL Server"
INSTALLSQLDATADIR="D:SQLData"
SQLUSERDBDIR="D:SQLData"
SQLUSERDBLOGDIR="E:SQLLog"
SQLTEMPDBDIR="F:TempDB"
SQLTEMPDBLOGDIR="F:TempDB"
SQLSYSADMINACCOUNTS="BUILTINAdministrators"
SQLSVCACCOUNT="NT ServiceMSSQLSERVER"
SQLSVCPASSWORD=""
AGTSVCACCOUNT="NT ServiceSQLSERVERAGENT"
AGTSVCSTARTUPTYPE="Automatic"
SQLSVCSTARTUPTYPE="Automatic"
BROWSERSVCSTARTUPTYPE="Automatic"
TCPENABLED="1"
NPENABLED="0"
SECURITYMODE="SQL"
SAPWD="YourStrongP@ssword123"
Save this file as sql_config.ini. Then run the installer from an elevated command prompt:
setup.exe /CONFIGURATIONFILE="C:Setupsql_config.ini"
The installer will run silently and log output to %ProgramFiles%Microsoft SQL Server160Setup BootstrapLog. Check Summary.txt and Detail.txt in the latest timestamped subfolder if you need to diagnose a failed installation.
If you prefer an interactive install, mount the ISO and run setup.exe directly. The Installation Center guides you through feature selection, service account configuration, collation, and data directories.
SQL Server Configuration Manager
After installation, SQL Server Configuration Manager is your primary tool for managing SQL Server services and network protocols. Open it from Start > Microsoft SQL Server 2022 > SQL Server Configuration Manager, or run SQLServerManager16.msc from a Run dialog.
The left pane shows three main sections: SQL Server Services, SQL Server Network Configuration, and SQL Native Client Configuration. Under SQL Server Services, you can start, stop, pause, and restart individual services, as well as configure their startup type and service account credentials.
Enabling TCP/IP
By default, TCP/IP may be disabled for named instances. You must enable it for remote connections to work. In SQL Server Configuration Manager, expand SQL Server Network Configuration, click Protocols for MSSQLSERVER (or your instance name), right-click TCP/IP, and select Enable. You will need to restart the SQL Server service for this change to take effect.
To verify the TCP port, double-click TCP/IP and select the IP Addresses tab. Scroll to IPAll at the bottom and confirm TCP Port is set to 1433 for the default instance. Named instances use dynamic ports by default; set a static port here if needed to simplify firewall rules.
# Restart SQL Server service via PowerShell
Restart-Service -Name MSSQLSERVER
Configuring SQL Server Browser
SQL Server Browser listens on UDP port 1434 and helps clients discover named instances on a server. For default instances using port 1433, it is not strictly required. For named instances, start and enable it:
Set-Service -Name SQLBrowser -StartupType Automatic
Start-Service -Name SQLBrowser
In SQL Server Configuration Manager, you can also enable SQL Server Browser under SQL Server Services by right-clicking it and selecting Start.
Service Accounts and NT Service Virtual Accounts
SQL Server uses several Windows services, each with its own account. The two most important are the Database Engine service and the SQL Server Agent service. Using the built-in virtual accounts NT ServiceMSSQLSERVER and NT ServiceSQLSERVERAGENT is the recommended approach for standalone installations. These accounts automatically receive the permissions they need (such as local file system rights and the ability to perform backup operations) without requiring a password or manual permission grants.
If you use a domain service account instead, ensure it has Log on as a service rights and is not subject to password expiration policies that would cause service outages. Grant the account the necessary file permissions on your data, log, and backup directories manually or via the installer.
Configuring the Windows Firewall for SQL Server
Remote clients cannot connect to SQL Server until you open the appropriate firewall ports. For the default instance on TCP 1433:
New-NetFirewallRule -DisplayName "SQL Server Default Instance" `
-Direction Inbound `
-Protocol TCP `
-LocalPort 1433 `
-Action Allow
New-NetFirewallRule -DisplayName "SQL Server Browser" `
-Direction Inbound `
-Protocol UDP `
-LocalPort 1434 `
-Action Allow
If you have multiple named instances on different ports, create a separate rule for each port. You can also allow the SQL Server executable itself through the firewall as an alternative to port-based rules:
New-NetFirewallRule -DisplayName "SQL Server Engine" `
-Direction Inbound `
-Program "C:Program FilesMicrosoft SQL ServerMSSQL16.MSSQLSERVERMSSQLBinnsqlservr.exe" `
-Action Allow
Verifying the Installation with sqlcmd
After installation and firewall configuration, verify that SQL Server is running and accessible using the sqlcmd command-line utility, which is installed alongside the database engine.
sqlcmd -S localhost -E -Q "SELECT @@VERSION"
The -E flag uses Windows Authentication (trusted connection). The output should display the SQL Server version string, edition, and build number, for example:
Microsoft SQL Server 2022 (RTM-CU12) (KB5033663) - 16.0.4115.5 (X64)
Feb 14 2024 08:44:00
Copyright (C) 2022 Microsoft Corporation
Developer Edition (64-bit) on Windows Server 2022 Standard 10.0 (Build 20348: )
To test SQL Server Authentication (Mixed Mode), use:
sqlcmd -S localhost -U sa -P "YourStrongP@ssword123" -Q "SELECT @@SERVERNAME, GETDATE()"
Reading the SQL Server Error Log
The SQL Server error log is the first place to look when diagnosing startup issues or operational errors. The current log is located at:
C:Program FilesMicrosoft SQL ServerMSSQL16.MSSQLSERVERMSSQLLogERRORLOG
You can also query the error log from within SQL Server using the system stored procedure:
EXEC xp_readerrorlog 0, 1, NULL, NULL, NULL, NULL, 'DESC'
SQL Server keeps several rotated error log files (ERRORLOG.1, ERRORLOG.2, etc.). On startup, SQL Server creates a new ERRORLOG file and rotates the old one. By default, six log files are retained. You can increase this under SQL Server Management Studio > SQL Server Logs > Configure.
SQL Server Management Studio Overview
SQL Server Management Studio (SSMS) is the primary GUI tool for administering SQL Server. It is a free download from Microsoft and is not included with the SQL Server installation media itself. Download it from https://aka.ms/ssmsfullsetup and install it on your server or on an admin workstation.
After installation, launch SSMS and connect to your server using either Windows Authentication or SQL Server Authentication. The Object Explorer on the left provides a tree view of all databases, security principals, SQL Server Agent jobs, and server-level configuration. Right-click the server node and select Properties to access important settings such as maximum server memory, degree of parallelism (MAXDOP), and authentication mode.
Key post-install configuration tasks in SSMS include: setting maximum server memory to prevent SQL Server from consuming all available RAM, configuring MAXDOP based on your NUMA topology, enabling the optimize for ad hoc workloads option to reduce plan cache bloat, and reviewing the surface area configuration to disable features not in use such as xp_cmdshell, Ole Automation Procedures, and CLR integration.
-- Set max server memory (example: 24 GB out of 32 GB total)
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'max server memory (MB)', 24576;
RECONFIGURE;
-- Set MAXDOP for an 8-core server with one NUMA node
EXEC sp_configure 'max degree of parallelism', 4;
RECONFIGURE;
-- Enable optimize for ad hoc workloads
EXEC sp_configure 'optimize for ad hoc workloads', 1;
RECONFIGURE;
With SQL Server installed, services running, firewall ports open, and SSMS connected, your SQL Server 2022 instance on Windows Server 2022 is ready for database creation and application connectivity.