Yes, you can install SQL Server entirely through the command line—no GUI required. This method is useful for developers, sysadmins, or automated deployments where you need to control every step precisely. The command-line installer supports fundamental editions (Express, Standard, Enterprise) and lets you skip or customize features, databases, and even optional components like management tools. You’ll need administrative access and the latest SQL Server installer files (`.msi` for Windows). No extra tools are needed beyond a PC with Windows (7/10/11) and elevated permissions.
What You'll Need
- Windows PC (Windows 7/10/11) with administrative rights
- SQL Server installer files (download from Microsoft)
- Network access to download the installer (if using online installers)
- A destination folder to extract the installer (e.g., `C:\SQLInstaller`)
- A text editor (optional) to review the installer’s `--q` or `--flags` options
Step-by-Step
- Extract the installer files: Download the SQL Server installation media (e.g., `SQLServer2022Enterprise.msi`) and extract it to a known folder (e.g., `C:\SQLInstaller`). If using the online installer, ensure you have internet access. For automated scripts, use PowerShell or a batch file to run `Expand-Archive` or `7z x` instead.
-
Launch the installer silently:
Navigate to the extracted folder in Command Prompt as Administrator and run:
sqlservr16setup.exe /q /I_ACCEPT_EULA=1 /I_ACCEPT_TOS=1 /FEATURES=SQLThe key switches:
/q= Quiet install (no GUI prompts)/I_ACCEPT_EULA=1= Accepts the End User License Agreement (required)/I_ACCEPT_TOS=1= Accepts the terms of service/FEATURES=SQL= Installs only the SQL Server core engine (omit to skip SQL; addADWSfor Windows Authentication,SSMSfor Management Studio).
sqlservr16setup.exewith the exact filename for your SQL version (e.g., `sqlservr15setup.exe` for SQL Server 2019). -
Customize installation options (optional):
Use flags like
/SKIPCOMPONENTSto exclude optional features (e.g.,SKIPCOMPONENTS=HighAvailabilityto skip failover clusters). For detailed control, append:/FEATURES=SQL /INSTALLDIR="C:\SQLSrv" /TARGETDIR="C:\SQLSrv"to set custom paths.Example for a lightweight install:
sqlservr16setup.exe /q /I_ACCEPT_EULA=1 /I_ACCEPT_TOS=1 /FEATURES=SQL,SSMS /INSTALLDIR="C:\SQLSrv" /TARGETDIR="C:\SQLSrv" -
Verify installation:
Open Command Prompt again and run:
sqlservr16setup.exe /q /VERBOSEto see logs, or check for services in Services Manager (search for "SQL Server"). If using Express Edition, ensuremssqlserverstarts automatically.
Common Mistakes
- Missing EULA acceptance: The installer stops with "EULA violation" if you omit
/I_ACCEPT_EULA=1. Double-check case sensitivity (EULA vs. eula). - Incorrect paths: If you set
INSTALLDIRbut didn’t define it earlier, the installer may fail. Always include both flags together. - Feature conflicts: Adding
ADWSalongsideSQLcan trigger duplicate service creation errors. Specify only required features. - Admin rights failure: Run Command Prompt as Administrator to avoid "access denied" errors.
Tips
- Use
sqlservr16setup.exe /q /VERBOSEto debug silently—output shows where it hangs. - For automated scripts, pre-generate a silent install command with
sqlservr16setup.exe /q /VERBOSEand copy the final flags. - Skip
SSMSif you don’t need the GUI management tools. - Test connectivity after installation with
net use \\(replace\SQLSrv with your PC name).
Troubleshooting
-
Installer hangs or crashes:
Try running
sqlservr16setup.exe /q /VERBOSEin a new Command Prompt. If it shows "Waiting for dependencies," check for corrupted files. Use another mirror to download the installer or repair it:msiexec /f/q /norestart -
Services not starting:
Verify the service name matches your
FEATURESlist. Right-click the service in Services Manager > Properties > Check "Automatic" startup type.If
mssqlserverfails, start it manually viasqlservr16setup.exe /q /STARTor usesqlcmd -S localhost -Q "SELECT @@VERSION"to confirm SQL is running. -
Permission denied errors:
Ensure your user is in the Local Administrators group. Reboot the PC if changes aren’t reflected.
For network installations (e.g., shared folders), map the drive first (e.g.,
net use Z: \\server\share) then point the installer toZ:\installer.msi.
Frequently Asked Questions
How do I install SQL Server in minimal steps?
Install only the core engine with/FEATURES=SQL and silent flags:
sqlservr16setup.exe /q /I_ACCEPT_EULA=1 /FEATURES=SQL
Can I install SQL Server 2022 silently via command line?
Yes. Replacesqlservr16setup.exe with the version-specific filename (e.g., `sqlservr20setup.exe`), and use the same /q flags.
What if the installer fails with "The operation completed successfully" but SQL isn’t installed?
The installer may exit quietly but not write to registry/Startup folder. Check services manually or verify SQL is running withsqlcmd -S localhost -Q "SELECT @@VERSION".
How do I uninstall SQL Server silently?
Usemsiexec /x {GUID} /q, where {GUID} is the product ID found in regedit under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall.
Do I need to accept the End User License Agreement (EULA)?
Yes. The/I_ACCEPT_EULA=1 flag is mandatory for any silent install.