- Регистрация
- 1 Мар 2015
- Сообщения
- 6,375
- Баллы
- 155
The default port of SQL Server is 1433. But I can be different in some installations.
In order to get the port the SQL Server is listening, we can execute the following query:
xp_readerrorlog 0, 1, N'Server is listening on'
2024-11-14 03:10:12.140 spid22s Server is listening on [ 'any' <ipv6> 57510].
2024-11-14 03:10:12.140 spid22s Server is listening on [ 'any' <ipv4> 57510].
2024-11-14 03:10:12.140 Server Server is listening on [ ::1 <ipv6> 57511].
2024-11-14 03:10:12.140 Server Server is listening on [ 127.0.0.1 <ipv4> 57511].
2024-11-14 03:10:12.150 spid22s Server is listening on [ ::1 <ipv6> 63454].
2024-11-14 03:10:12.150 spid22s Server is listening on [ 127.0.0.1 <ipv4> 63454].
As we can see, the query is showing the server is listening to port 57510 from any IP address.
In order to get the port the SQL Server is listening, we can execute the following query:
xp_readerrorlog 0, 1, N'Server is listening on'
2024-11-14 03:10:12.140 spid22s Server is listening on [ 'any' <ipv6> 57510].
2024-11-14 03:10:12.140 spid22s Server is listening on [ 'any' <ipv4> 57510].
2024-11-14 03:10:12.140 Server Server is listening on [ ::1 <ipv6> 57511].
2024-11-14 03:10:12.140 Server Server is listening on [ 127.0.0.1 <ipv4> 57511].
2024-11-14 03:10:12.150 spid22s Server is listening on [ ::1 <ipv6> 63454].
2024-11-14 03:10:12.150 spid22s Server is listening on [ 127.0.0.1 <ipv4> 63454].
As we can see, the query is showing the server is listening to port 57510 from any IP address.