I Install SQL server in my system and I have to check on which port number SQL is working in my system
-
3The default port for SQL is 1433, have you checked that?– JamesOct 18, 2013 at 13:58
-
stackoverflow.com/questions/12297475/…– TejaOct 18, 2013 at 13:58
-
1Duplicate of: stackoverflow.com/questions/12297475/…– BrianOct 18, 2013 at 13:59
-
Does this answer your question? How to find SQL Server running port?– Alexei - check CodidactMay 22 at 13:09
7 Answers
- Open SQL Server Management Studio
- Connect to the database engine for which you need the port number
Run the below query against the database
select distinct local_net_address, local_tcp_port from sys.dm_exec_connections where local_net_address is not null
The above query shows the local IP as well as the listening Port number
-
-
24
-
3@trilawney If you are connecting to the database locally it won't return any rows. You will have to connect to the database remotely. When you connect locally it uses shared memory to connect, when you connect remotely it connects through TCP. Aug 4, 2016 at 7:30
-
1Thanks Punter. That was helpful. I figured it out using netstat -abn Aug 4, 2016 at 12:40
-
1@YashiSrivastava, This query is for Microsoft SQL Server. You can use "SHOW VARIABLES WHERE Variable_name = 'port'" for MySQL. For more information on show variables refer, dev.mysql.com/doc/refman/8.0/en/show-variables.html Aug 14, 2018 at 8:39
You can also use this query
USE MASTER
GO
xp_readerrorlog 0, 1, N'Server is listening on'
GO
Source : sqlauthority blog
Open Run in your system.
Type
%windir%\System32\cliconfg.exe
Click on ok button then check that the "TCP/IP Network Protocol Default Value Setup" pop-up is open.
Highlight TCP/IP under the Enabled protocols window.
Click the Properties button.
Enter the new port number, then click OK.
-
This caused my SQL Server Management Studio to malfunction (due to a null number bug in Visual Studio 2010). It was able to connect and list tables, as well as open an edit 200 rows view, but failed to open a new query window. Mar 29, 2015 at 20:42
-
@Ankit Jain: Can you explain what this does? If this is changing the server config, then what are the side-effects of the said change? Jan 31, 2022 at 20:55
Visually you can open "SQL Server Configuration Manager" and check properties of "Network Configuration":
-
What does Enabled = No mean? I have values defined from IP1 to IP8, but for all of them Enabled = No is set. Dec 10, 2014 at 12:18
This query works for me:
SELECT DISTINCT
local_tcp_port
FROM sys.dm_exec_connections
WHERE local_tcp_port IS NOT NULL
-
1
To check all the applications listening on all ports, there is command:
netstat -ntpl
-
5On Windows Server 2008 and Windows 7 I need to use
netstat -ap TCP
to display listening (and connected) TCP ports– Paul B.Apr 9, 2014 at 7:37 -
This is the only way I could find to get the port number from the client side, without the ability to RDP into the server, or run administrative stored procs. Thanks so much! May 10, 2017 at 19:27
PowerShell solution that shows all of the instances on the host as well as their incoming traffic addresses. The second bit might be helpful if all you know is the DNS:
ForEach ($SQL_Proc in Get-Process | Select-Object -Property ProcessName, Id | Where-Object {$_.ProcessName -like "*SQL*"})
{
Get-NetTCPConnection | `
Where-Object {$_.OwningProcess -eq $SQL_Proc.id} | `
Select-Object -Property `
@{Label ="Process_Name";e={$SQL_Proc.ProcessName}}, `
@{Label ="Local_Address";e={$_.LocalAddress + ":" + $_.LocalPort }}, `
@{Label ="Remote_Address";e={$_.RemoteAddress + ":" + $_.RemotePort}}, State | `
Format-Table
}
-
This worked great. Would be nice if it could somehow include the instance name. Feb 28 at 2:33