How to find SQL Server running port?
Yes I read this How to find the port for MS SQL Server 2008?
returns connection failed, so I must specify other port.
I tried to use
but I don't see sqlservr.exe or something similar on this list.
Why it so difficult to find that port? :/
USE master GO xp_readerrorlog 0, 1, N'Server is listening on' GO
very simple. make a note of the sqlsrvr.exe PID from taskmanager then run this command:
netstat -ano | findstr *PID*
it will show TCP and UDP connections of your SQL server (including ports) standard is 1433 for TCP and 1434 for UDP
Read more... Read less...
This is the one that works for me:
SELECT DISTINCT local_tcp_port FROM sys.dm_exec_connections WHERE local_tcp_port IS NOT NULL
If you can start the Sql Server Configuration Manager > SQL Server Network Configuration > Your instance > TCP/IP > Properties
If you have run "netstat -a -b -n" (from an elevated command prompt) and you don't see "sqlservr.exe" at all then either your SQL Server service is not running or its TCP/IP network library is disabled.
Run SQL Server Configuration Manager (Start | All Programs | Microsoft SQL Server 2008 | Configuration Tools).
Navigate to SQL Server Services. In the right-hand pane look for SQL Server (). Is it stopped? If so, start it.
Navigate to SQL Server Network Configuration (or SQL Server Network Configuration (32-bit) as appropriate) then Protocols for . In the right-hand pane look for "TCP/IP". Is it disabled? If so, enable it, then restart the SQL Server service.
Note that he Instance ID will be MSSQLSERVER for the default instance.
Please also note that you don't have to enable the TCP/IP network library to connect a client to the service. Clients can also connect through the Shared Memory network library (if the client is on the same machine) or the Named Pipes network library.
Maybe it's not using TCP/IP
Have a look at the SQL Server Configuration Manager to see what protocols it's using.
In our enterprise I don't have access to MSSQL Server, so I can'r access the system tables.
What works for me is:
- capture the network traffic
Wireshark(run as Administrator, select Network Interface),while opening connection to server.
- Find the ip address with
- filter with
ip.dst == x.x.x.x
The port is shown in the column
info in the format
src.port -> dst.port