https://learn.microsoft.com/zh-cn/sql/tools/configuration-manager/named-pipes-properties?view=sql-server-ver16
https://learn.microsoft.com/zh-cn/sql/tools/configuration-manager/client-protocols-named-pipes-properties-protocol-tab?view=sql-server-ver16
默認情況下, SQL Server 偵聽:\.\pipe\sql\query(對于默認實例)和 \.\pipe\MSSQL$\sql\query(對于命名實例)
Unless changed by the user, when the default instance of Microsoft SQL Server listens on the named pipes protocol, it uses \.\pipe\sql\query as the pipe name. The period indicates that the computer is the local computer, pipe indicates that the connection is a named pipe, and sql\query is the name of the pipe. To connect to the default pipe, the alias must have \<computer_name>\pipe\sql\query as the pipe name. If SQL Server has been configured to listen on a different pipe, the pipe name must use that pipe. For instance, if SQL Server is using \.\pipe\unit\app as the pipe, the alias must use \<computer_name>\pipe\unit\app as the pipe name.
At the time of connection, the SQL Server Native Client component reads the server, protocol, and pipe name values from the registry for the specified alias name, and creates a pipe name in the format np:\<computer_name>\pipe<pipename> or np:\\pipe<pipename>. For a named instance, the default pipe name is \<computer_name>\pipe\MSSQL$<instance_name>\sql\query.
SSMS如何以Named pipe方式連接sqlserver,直接在SSMS的Servername一欄填上np:servername
SELECT session_id, net_transport,auth_scheme,client_net_address,client_tcp_port,local_net_address,local_tcp_port FROM sys.dm_exec_connections
session_id net_transport auth_scheme client_net_address client_tcp_port local_net_address local_tcp_port
54 TCP KERBEROS 172.22.136.35 55293 172.22.136.187 1433
58 Named pipe KERBEROS <named pipe> NULL NULL NULL
63 Session NTLM <local machine> NULL NULL NULL
64 Shared memory NTLM <local machine> NULL NULL NULL
--net_transport值為TCP的表示是TCP連接,值為Named pipe的表示是Named pipe連接,值為Shared memory的一般是在數據庫本地的連接類似mysql的socket連接且auth_scheme一般是NTLM