Home >Common Problem >How to check the sqlserver port number

How to check the sqlserver port number

下次还敢
下次还敢Original
2024-04-05 21:21:171037browse

There are two ways to query the SQL Server port number: Use SQL Server Configuration Manager to view the "Port" field of the "TCP/IP" protocol. Use a T-SQL statement to execute SELECT net_transport, local_tcp_port FROM sys.dm_exec_connections WHERE session_id = @@SPID and then check the "local_tcp_port" field. The default port number is 1433, but other port numbers can be configured if necessary.

How to check the sqlserver port number

SQL Server port number query

How to query the SQL Server port number?

There are two ways to query the SQL Server port number:

Method 1: Use SQL Server Configuration Manager

  1. Open SQL Server Configuration Manager.
  2. Expand "SQL Server Network Configuration".
  3. Click "Protocol for [instance_name]".
  4. In the right pane, find the "TCP/IP" protocol, and then view the "Port" field.

Method 2: Use T-SQL statement

  1. Open SQL Server Management Studio.
  2. Connect to a SQL Server instance.
  3. Execute the following T-SQL statement:
<code class="sql">SELECT net_transport, local_tcp_port
FROM sys.dm_exec_connections
WHERE session_id = @@SPID;</code>
  1. In the results, find the row for the "net_transport" column with the value "TCP" and view "local_tcp_port" field.

Other notes:

  • Typically, the default port number of SQL Server is 1433.
  • In some cases, it may be necessary to configure other port numbers, such as if there are restrictions in firewalls or other network settings.
  • For SQL Server Express edition, the port number may be different.

The above is the detailed content of How to check the sqlserver port number. 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
Previous article:How to install sqlserverNext article:How to install sqlserver