Install SQL Server Express on a Windows VPS and Allow Remote Access Safely

IM Host Editorial6 min read
SQL Server Express running on a Windows VPS with remote access restricted by firewall

SQL Server Express is the free edition of SQL Server. It is a solid choice for small business apps, accounting software and internal tools on a Windows VPS. After a default install, though, it only accepts local connections. That is a safe default. This guide installs Express, enables remote access the careful way, and covers the parts people skip: least-privilege logins, a tight firewall rule, encryption and backups.

In the examples, 203.0.113.10 is your VPS, 198.51.100.25 is the IP that needs access, and SQLEXPRESS is the instance name.

Check the Express limits first

  • Database size: 10GB per database in SQL Server 2022 Express and earlier; 50GB per database in SQL Server 2025 Express.

  • Compute: the lesser of 1 socket or 4 cores.

  • Memory: about 1.4GB (1,410MB) for the buffer pool per instance.

  • No SQL Server Agent: scheduled jobs such as backups need Task Scheduler instead. Backup compression is also not available.

The memory cap is good news on a small VPS: SQL Server will not take all the RAM from Windows and your app. As a rule of thumb, 4GB of RAM is a comfortable start for Windows Server, Express and a small application on the same server.

Step 1: Install SQL Server Express

Download the Express installer from Microsoft's SQL Server downloads page and choose Custom rather than Basic. Custom lets you set authentication during setup. In the wizard:

  1. Choose New SQL Server standalone installation.

  2. Select Database Engine Services. You do not need the other features for this guide.

  3. Keep the named instance SQLEXPRESS.

  4. Under Authentication, choose Mixed Mode, set a long random password for sa (you will disable it later) and add your current Windows account as an administrator.

Install SQL Server Management Studio (SSMS) on your own computer or on the server. Then confirm the engine runs:

PowerShell
Get-Service -Name 'MSSQL$SQLEXPRESS'
sqlcmd -S .\SQLEXPRESS -E -C -Q "SELECT @@VERSION"

-E signs in with your Windows account. -C trusts the server's self-signed certificate, which newer sqlcmd versions otherwise reject because they encrypt by default. That is fine for a local test.

Step 2: Enable TCP/IP and set a fixed port

Express ships with TCP/IP turned off, and a named instance listens on a dynamic port that can change after a restart. Clients then rely on the SQL Server Browser service on UDP 1434 to find it. That means one more open port. A fixed port is simpler and easier to firewall.

  1. Open SQL Server Configuration Manager (SQLServerManager16.msc for SQL Server 2022, SQLServerManager17.msc for 2025).

  2. Go to SQL Server Network Configuration, Protocols for SQLEXPRESS, and enable TCP/IP.

  3. Open TCP/IP properties, IP Addresses tab, scroll to IPAll. Clear TCP Dynamic Ports and set TCP Port to 1433.

Restart the service and check that it listens:

PowerShell
Restart-Service -Name 'MSSQL$SQLEXPRESS' -Force
netstat -ano | findstr :1433

A non-standard port such as 14333 cuts down log noise from scanners, but it is not a security control. The firewall rule and the logins are what protect you.

Step 3: Create a least-privilege login and disable sa

Your application should not connect as sa or any sysadmin. If the app account leaks, the damage should stay inside one database. Save this as setup.sql:

Code
CREATE DATABASE AppDb;
GO
CREATE LOGIN app_user WITH PASSWORD = 'Use-a-long-random-password-here-42!', CHECK_POLICY = ON;
GO
USE AppDb;
CREATE USER app_user FOR LOGIN app_user;
ALTER ROLE db_datareader ADD MEMBER app_user;
ALTER ROLE db_datawriter ADD MEMBER app_user;
GO
ALTER LOGIN sa DISABLE;
GO

Run it:

Code
sqlcmd -S .\SQLEXPRESS -E -C -i setup.sql

If the application creates or changes tables itself (migrations), it also needs db_ddladmin in that database. Before you disable sa, make sure your Windows account is a sysadmin, or you lock yourself out of administration. Disabling sa matters because most password-guessing against port 1433 targets that exact name.

If you picked Windows authentication only during setup, switch to mixed mode in SSMS: server Properties, Security, "SQL Server and Windows Authentication mode", then restart the service.

Step 4: Open the firewall only to the IPs that need it

First ask whether anything outside the server needs the database at all. If your app runs on the same VPS, it connects locally and you should not open 1433. When remote access is needed, allow only known addresses:

PowerShell
New-NetFirewallRule -DisplayName "SQL Server 1433 - office" -Direction Inbound -Protocol TCP -LocalPort 1433 -RemoteAddress 198.51.100.25 -Action Allow

Add more addresses separated by commas, for example -RemoteAddress 198.51.100.25,198.51.100.26. Never use a rule that allows 1433 from any address. Test from the client side:

PowerShell
Test-NetConnection 203.0.113.10 -Port 1433

To see whether someone is trying passwords, search the SQL Server error log for failed logins (error 18456):

Code
EXEC sp_readerrorlog 0, 1, 'Login failed';

Step 5: Encrypt the connection

SQL Server always encrypts the login exchange. To encrypt all traffic and let clients verify they reach the real server, the instance needs a certificate whose name matches the host name clients use, for example db.example.com. Import it in Configuration Manager under Protocols for SQLEXPRESS, Properties, Certificate tab, then set Force Encryption to Yes and restart the service.

Current drivers encrypt by default and validate the certificate. With only the self-signed certificate, you will see "The certificate chain was issued by an authority that is not trusted". Setting TrustServerCertificate=True makes the error go away, but the client then skips the server identity check. Use it for testing, not as the permanent setup. A typical connection string:

Code
Server=db.example.com,1433;Database=AppDb;User Id=app_user;Password=...;Encrypt=True;TrustServerCertificate=False;

Note the comma between host and port. That is SQL Server syntax, not a colon.

The safer alternative: do not expose 1433 at all

If the remote access is only for you or a developer using SSMS, a tunnel is usually better than an open port. With OpenSSH Server enabled on the VPS, forward a local port:

Bash
ssh -L 14330:localhost:1433 [email protected]

Then connect SSMS to localhost,14330. The database port stays closed to the internet, and access depends on your SSH key. A VPN such as WireGuard gives the same benefit for a whole team.

Backups without SQL Server Agent

Express has no Agent, so schedule backups with Task Scheduler. Create C:\Scripts\backup-appdb.cmd:

Code
sqlcmd -S .\SQLEXPRESS -E -C -Q "BACKUP DATABASE AppDb TO DISK = N'C:\Backups\AppDb.bak' WITH INIT, CHECKSUM"

The SQL Server service writes the backup file, not your user, so give its service account write access to the folder (in PowerShell):

Code
icacls C:\Backups /grant 'NT Service\MSSQL$SQLEXPRESS:(OI)(CI)M'

In Task Scheduler, create a daily task that runs the script under an administrator account that is a sysadmin in SQL Server, with "Run whether user is logged on or not". WITH INIT overwrites one file each night. That is simple, but it keeps only one copy. Copy the file off the server every day, and test a restore now and then. A backup you have never restored is only a hope.

Run it on IM HOST

IM HOST Windows VPS RDP plans start at $8.99/month (2 cores, 4GB RAM) with full Administrator access, which is what you need to install SQL Server, change services and manage the firewall. For a database that needs steady CPU, Cloud VPS starts at $16/month with 4 dedicated vCPU, 8GB RAM and 80GB NVMe, plus a free automatic backup every 3 days. Keep your own SQL backups as well. 24/7 engineer support, no setup fees and a 30-day money-back guarantee apply to both.

IM Host EditorialOctober 25, 2026All articles