Home  >  Article  >  How to check the port number of sqlserver

How to check the port number of sqlserver

下次还敢
下次还敢Original
2024-04-05 22:12:191174browse

SQL Server port number viewing method

Direct query:

<code class="sql">SELECT name AS 'Port Name', physical_network_address AS 'Port Number'
FROM sys.dm_exec_connections
WHERE session_id = @@SPID</code>

Use PowerShell:

<code class="powershell">Get-Service "MSSQL$<instance name>" | Select Name, CurrentState, Port</code>

Using SQL Server Management Studio (SSMS):

  1. Open SSMS and connect to the SQL Server instance.
  2. In Object Explorer, expand "Server Name" > "Connections".
  3. Right-click "TCP/IP" and select "Properties".
  4. On the "IP Address" tab, find the "TCP Port" field.

Other methods:

  • Use netstat command:
<code>netstat -ano | findstr "<process id>"</code>
  • View SQL Server Configuration Manager:
  1. Open SQL Server Configuration Manager.
  2. Expand "SQL Server Network Configuration" > "Protocols for".
  3. Find the protocol you want to view the port number for, then right-click and select "Properties".

The above is the detailed content of How to check the port number of sqlserver. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn