Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / SQL Server / Change the Default Port Number (TCP/1433) for a MS SQL Server Instance

March 15, 2021 SQL Server

Change the Default Port Number (TCP/1433) for a MS SQL Server Instance

In this article, we will show you how to check the current TCP port on which a named or default MS SQL Server instance is listening (waiting for connection on), how to change an SQL Server connection port to a static/dynamic one, and how the SQL Server Browser service is used by clients to connect to MSSQL.

  • The default SQL Server instance (MSSQLSERVER) uses static TCP port 1433. It is the port the clients or SQL Server Management Studio (SSMS) console connect to;
  • Named MSSQL and SQL Server Compact instances are configured to use a dynamic TCP port from the RPC range (49152 – 65535).

A dynamic port means that the port number of the MSSQL instance accepts connections on is assigned after the SQL Server service is started. In most cases, even after a server reboot, SQL Server will listen the same dynamic TCP port assigned prior to the restart. But if the port number is busy, SQL Server will run on a new TCP port. An app that connects to MSSQL usually gets the new port number from the SQL Server Browser service without any problem ( we will tell about it later). Dynamic SQL Server ports are convenient when you manage multiple SQL instances on a single host, but they cause a lot of problems when firewalls are implemented in your network.

Contents:
  • Configuring MS SQL Server Instance to Listen on a Specific Port
  • SQL Server Browser Service: TCP and UDP Ports

Configuring MS SQL Server Instance to Listen on a Specific Port

You can reconfigure your SQL server to listen on static or dynamic TCP port. Typically, you may need it when multiple SQL Server instances are running on a single host, or firewalls are used in your network.

To manage listen ports, you will need the SQL Server Configuration Manager. Usually, this snap-in is installed together with an MSSQL instance.

Open SQL Server Configuration Manager and expand the SQL Server Network Configuration section.

In my case, there is only 1 MSSQL instance running on the server, so I will configure listening ports for it. The list of available protocols for an instance contains the following:

  • The Shared Memory protocol is used to connect from a local computer (the one an MSSQL instance is installed on). It is not recommended to disable it;
  • Named Pipes may be used over the TCP/IP protocol. But its use doesn’t give us much benefit, so we will leave it enabled.
  • TCP/IP is where MSSQL network options are configured.

setting network setting with sql server configuration manager

Double-click TCP/IP.

tcp/ip properties of the sql server named instance

There are only 3 parameters on the Protocol tab::

  • Enabled – to make sure that the TCP/IP protocol is enabled;
  • Keep Alive how often to send keep-alive packets to make sure the connection is still available (in milliseconds). Do not change the parameter without a need;
  • Listen All is an unobvious setting responsible for the contents of the IPAll section in the IP Addresses tab. If the value of Listen All is No, the IPAll section is ignored

On the IP Addresses tab, you can see the list of all IP addresses of the computer (including IPv6 and local ones) and their settings. Here you can configure different TCP ports for a local and an external connection address, or different ports for different external addresses (if your server has multiple network interfaces in different segments, for example then using VLANs or multiple IP aliases).

ipall settings in mssql server ip addresses tab

It is likely that you may want to change ports for all IP addresses at once, so change its IPAll section.

how to change default port number on MySQL

The TCP Dynamic Ports option is related to using dynamic ports.

  • An empty TCP Dynamic Ports value disables using dynamic SQL Server ports;
  • 0 enables using dynamic TCP ports from the RPC range 49152 – 65535;
  • It doesn’t make any sense to set any fixed port value here — it changes each time after the MSSQL instance is restarted.

To set a static TCP port for an SQL Server instance, disable TCP Dynamic Ports and specify a new number of the static port in the TCP Port parameter.

How To Set Static TCP Port ) in Microsoft SQL Server?

To apply the changes, restart the SQL Server service. Note that SQL Server Browser service is stopped.

restarting sql server instance

Make sure you can connect to your SQL instance using SSMS over the new fixed TCP port. The connection string format is as follows:

hostname\lab-sql, PortNumber

How to connect SQL Server using different TCP port?

You won’t be able to connect without specifying the listening port because the SQL Browser service is disabled.

SQL Server Browser Service: TCP and UDP Ports

Before MSSQL 2000 you could not install more than one SQL instance on a host. This feature appeared in newer MSSQL versions. SQL Server Browser appeared in SQL Server 2005 and was used as an intermediary service to distribute connections between multiple MSSQL instances installed on the same computer.

Also, SQL Server Browser is responsible for connection to MSSQL (for example, from SQL Server Management Studio) without specifying a port number (hostname\lab-sql). SQL Server Browser gets the current dynamic port number of an instance from the registry and sends it to a client.

If you disable the SQL Server Browser service, you will have to specify the TCP port manually. For example, hostname\lab-sql, 1440.

If the SQL Server Browser service is stopped and dynamic ports are used, apps won’t be able to get port numbers to connect to.

Standard SQL Server ports:

  • TCP 1433 is the standard SQL Server port;
  • UDP 1434 is a port used by SQL Server Browser.

Other ports are configured when you install/configure a specific service.

If you are using strict firewall settings or if you want to restrict SQL Server as much as possible, it is recommended to disable Dynamic Ports (set an empty value) and disable the SQL Server Browser.

If your SQL servers have public access, it is worth to change the default port number. It will not protect you from hacker attacks completely, but their frequency will be reduced.

0 comment
1
Facebook Twitter Google + Pinterest
previous post
How to Shadow (Remote Control) a User’s RDP session on RDS Windows Server 2016/2019?
next post
How to Sign a PowerShell Script (PS1) with a Code Signing Certificate?

Related Reading

Connect to MS SQL Server Database in Visual...

June 20, 2023

Find and Remove Locks in Microsoft SQL Server

March 3, 2023

MS SQL Server Setup Stucks on Install/Uninstall

January 9, 2023

Configure SSL Connection Encryption in MS SQL Server

August 15, 2022

How to Reset SA Password on Microsoft SQL...

December 21, 2021

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • How to Connect VPN Before Windows Logon

    November 14, 2023
  • Removing Azure Arc Setup Feature on Windows Server 2022

    November 9, 2023
  • Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

    November 7, 2023
  • Send Emails with Microsoft Graph API and PowerShell

    November 6, 2023
  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Configure SSL Connection Encryption in MS SQL Server
  • MS SQL Server 2019 Installation Guide: Basic Settings and Recommendations
  • How to Reset SA Password on Microsoft SQL Server
  • Querying Microsoft SQL Server (MSSQL) Database with PowerShell
  • Configuring Always-On High Availability Groups on SQL Server
  • Upgrade Microsoft SQL Server Evaluation Edition to Standard/Enterprise
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top