SQL Server 的默认端口

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/152834/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 23:42:33  来源:igfitidea点击:

Default port for SQL Server

asp.netsqlsql-server

提问by balaweblog

I need to know the default port settings for the following services

我需要知道以下服务的默认端口设置

  1. SQL Server
  2. SQL Browser
  3. SQL Reporting services
  4. SQL Analysis services
  1. 数据库服务器
  2. SQL 浏览器
  3. SQL 报告服务
  4. SQL 分析服务

I neeed to know the port settings for these services for different versions of SQL Server (2000,2005,2008)

我需要知道不同版本的 SQL Server (2000,2005,2008) 的这些服务的端口设置

Also let me know whether the default port setting will change based on sql server versions

还让我知道默认端口设置是否会根据 sql server 版本而改变

Thanks in advance.

提前致谢。

回答by ScottStonehouse

  1. The default SQL Server port is 1433 but only if it's a default install. Named instances get a random port number.

  2. The browser service runs on port UDP 1434.

  3. Reporting services is a web service - so it's port 80, or 443 if it's SSL enabled.

  4. Analysis services is 2382 but only if it's a default install. Named instances get a random port number.

  1. 默认 SQL Server 端口是 1433,但前提是它是默认安装。命名实例获得一个随机端口号。

  2. 浏览器服务在端口 UDP 1434 上运行。

  3. 报告服务是一项 Web 服务 - 因此它是端口 80,如果启用了 SSL,则是端口 443。

  4. 分析服务是 2382,但前提是它是默认安装。命名实例获得一个随机端口号。

回答by Jared Moore

If you have access to the server then you can use

如果您有权访问服务器,则可以使用

select local_tcp_port from sys.dm_exec_connections where local_tcp_port is not null

For full details see port number of SQL Server

有关完整详细信息,请参阅SQL Server 的端口号

回答by Mike Dimmick

The default, unnamed instance always gets port 1433 for TCP. UDP port 1434 is used by the SQL Browser service to allow named instances to be located. In SQL Server 2000 the first instance to be started took this role.

默认的未命名实例始终为 TCP 获取端口 1433。SQL Browser 服务使用 UDP 端口 1434 来允许定位命名实例。在 SQL Server 2000 中,要启动的第一个实例担任此角色。

Non-default instances get their own dynamically-allocated port, by default. If necessary, for example to configure a firewall, you can set them explicitly. If you don't want to enable or allow access to SQL Browser, you have to either include the instance's port number in the connection string, or set it up with the Alias tab in cliconfg(SQL Server Client Network Utility) on each client machine.

默认情况下,非默认实例获得自己动态分配的端口。如有必要,例如配置防火墙,您可以明确设置它们。如果不想启用或允许访问 SQL 浏览器,则必须在连接字符串中包含实例的端口号,或者使用cliconfg每台客户端计算机上(SQL Server 客户端网络实用工具)中的别名选项卡进行设置。

For more information see SQL Server Browser Serviceon MSDN.

有关详细信息,请参阅MSDN 上的SQL Server Browser 服务

回答by Mladen

1433

1433

the default port hasn't changed yet

默认端口还没有改变

回答by leolegas

SQL Server default port is 1434.

SQL Server 默认端口是1434

To allow remote access I had to release those ports on my firewall:

为了允许远程访问,我必须在我的防火墙上释放这些端口:

Protocol  |   Port
---------------------
UDP       |   1050
TCP       |   1050
TCP       |   1433
UDP       |   1434

回答by gngolakia

We can take a look at three different ways you can identify the port used by an instance of SQL Server.

我们可以通过三种不同的方式来识别 SQL Server 实例使用的端口。

  1. Reading SQL Server Error Logs
  2. Using SQL Server Configuration Manager
  3. Using Windows Application Event Viewer

    USE master
    GO

    xp_readerrorlog 0, 1, N'Server is listening on', 'any', NULL, NULL, N'asc'
    GO

  1. 读取 SQL Server 错误日志
  2. 使用 SQL Server 配置管理器
  3. 使用 Windows 应用程序事件查看器

    使用大师
    GO

    xp_readerrorlog 0, 1, N'Server 正在监听', 'any', NULL, NULL, N'asc'
    GO

Identify Port used by SQL Server Database Engine Using SQL Server Configuration Manager

  1. Click Start -> Programs -> Microsoft SQL Server 2008 -> Configuration Tools -> SQL Server Configuration Manager

  2. In SQL Server Configuration Manager, expand SQL Server Network Configuration and then select Protocols for on the left panel. To identify the TCP/IP Port used by the SQL Server Instance, right click onTCP/IP and select Properties from the drop down as shown below.

使用 SQL Server 配置管理器识别 SQL Server 数据库引擎使用的端口

  1. 单击开始 -> 程序 -> Microsoft SQL Server 2008 -> 配置工具 -> SQL Server 配置管理器

  2. 在 SQL Server 配置管理器中,展开 SQL Server 网络配置,然后在左侧面板上选择协议。要识别 SQL Server 实例使用的 TCP/IP 端口,请右键单击 TCP/IP 并从下拉列表中选择属性,如下所示。

For More Help
http://sqlnetcode.blogspot.com/2011/11/sql-server-identify-tcp-ip-port-being.html

如需更多帮助
http://sqlnetcode.blogspot.com/2011/11/sql-server-identify-tcp-ip-port-being.html

回答by pelazem

You can use SQL Configuration Manager to set individual IP addresses to use dynamic ports or not (value of 0 = yes, use dynamic port), and to set the TCP port used for each IP.

您可以使用 SQL 配置管理器设置单个 IP 地址是否使用动态端口(值 0 = 是,使用动态端口),以及设置用于每个 IP 的 TCP 端口。

But be careful: I recommend first mapping out your instances, IPs, and ports, and planning such that no instances or IPs step on each other before starting to make changes willy-nilly.

但要小心:我建议首先映射您的实例、IP 和端口,并进行规划,以便在开始随意更改之前没有实例或 IP 相互干扰。