Find us on social media
SQL ServerDatabaseWindows6 min read
Install SQL Server Express
Install SQL Server Express, enable remote connections, and create databases for your applications.
SQL Server Express is a free edition of Microsoft SQL Server suitable for small databases (up to 10 GB) and development workloads.
Step 1 — Download SQL Server Express
Open PowerShell and download the installer:
powershell
# Download SQL Server Express installer
Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?linkid=2216019" -OutFile "C:\temp\SQLServerExpress.exe"Or download manually from the Microsoft website.
Step 2 — Run the installer
powershell
C:\temp\SQLServerExpress.exe /ACTION=Install /FEATURES=SQLEngine /INSTANCENAME=SQLEXPRESS /SQLSYSADMINACCOUNTS="BUILTIN\Administrators" /SECURITYMODE=SQL /SAPWD="YourStr0ngP@ssword!" /IACCEPTSQLSERVERLICENSETERMS /QUIETStep 3 — Verify the installation
powershell
Get-Service MSSQL*You should see MSSQL$SQLEXPRESS running.
Step 4 — Enable TCP/IP connections
powershell
# Import SQL Server module
Import-Module SQLPS -DisableNameChecking
# Enable TCP/IP
$smo = 'Microsoft.SqlServer.Management.Smo.'
$wmi = New-Object ($smo + 'Wmi.ManagedComputer')
$tcp = $wmi.GetSmoObject("ManagedComputer[@Name='$env:COMPUTERNAME']/ServerInstance[@Name='SQLEXPRESS']/ServerProtocol[@Name='Tcp']")
$tcp.IsEnabled = $true
$tcp.Alter()
# Restart the service
Restart-Service 'MSSQL$SQLEXPRESS'Step 5 — Allow through firewall
powershell
New-NetFirewallRule -DisplayName "SQL Server" -Direction Inbound -Protocol TCP -LocalPort 1433 -Action Allow
New-NetFirewallRule -DisplayName "SQL Server Browser" -Direction Inbound -Protocol UDP -LocalPort 1434 -Action AllowStep 6 — Connect with sqlcmd
powershell
sqlcmd -S .\SQLEXPRESS -U sa -P "YourStr0ngP@ssword!"Create a test database:
sql
CREATE DATABASE MyAppDB;
GO
USE MyAppDB;
GO
CREATE TABLE Test (Id INT PRIMARY KEY, Name NVARCHAR(50));
GOInstall SSMS (optional)
SQL Server Management Studio provides a GUI:
powershell
Invoke-WebRequest -Uri "https://aka.ms/ssmsfullsetup" -OutFile "C:\temp\SSMS-Setup.exe"
C:\temp\SSMS-Setup.exe /install /quiet /norestartTip
For production workloads exceeding 10 GB or needing advanced features, consider SQL Server Standard or use PostgreSQL/MySQL as alternatives on your Baires Host VPS.
Was this guide helpful?