DEV Community

Cover image for SQL Server: Get database port
Sergio Peris
Sergio Peris

Posted on β€’ Originally published at sertxu.dev

SQL Server: Get database port

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'
Enter fullscreen mode Exit fullscreen mode
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].
Enter fullscreen mode Exit fullscreen mode

As we can see, the query is showing the server is listening to port 57510 from any IP address.

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series πŸ“Ί

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series πŸ‘€

Watch the Youtube series

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay