This article provides several ways to identify the TCP/IP port number used by SQL Server.
Find the Running Port Number through Query
The following query provides a direct answer about TCP/IP port used by the SQL Server, as well as the SQL Server’s IP address.
SELECT DISTINCT local_net_address, local_tcp_port FROM sys.dm_exec_connections WHERE local_net_address IS NOT NULL;
Find the Running Port Number through xp_readerrorlog
The command xp_readerrorlog read the SQL Server logs, which consists of SQL Server boot log, to find the SQL Server listening port through keywords in the boot log.
USE master GO xp_readerrorlog 0, 1, N'Server is listening on' GO
Get the Running Port from the TCP/IP Properties
- Open the SQL Server Configuration Manager
- In the SQL Server Configuration Manager, under the SQL Server Network Configuration, select your SQL Server instance.
- After that, right click on TCP/IP and select Properties. You will find the SQL Server running port on the following screen.