远程 MS SQL 2008 连接

远程 MS SQL 2008 连接

您好,我在设置 MS SQL 服务器以便远程连接时遇到了问题。我已在 SQL 服务器本身中启用了远程访问,并在配置管理器中启用了 TCP 连接。并且我在 Windows 防火墙中添加了允许端口 1433!但是当我尝试连接时,什么都没有。然后我尝试完全禁用防火墙,突然间我能够连接,所以问题一定出在防火墙上。但是,除了在入站部分添加允许端口 1433 之外,我还必须设置什么,才能让防火墙允许远程访问我的 MS SQL 服务器?

        C:\Windows\system32>netstat -a -b

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:21             DoomServer:0           LISTENING
 [FileZilla Server.exe]
  TCP    0.0.0.0:25             DoomServer:0           LISTENING
 [hMailServer.exe]
  TCP    0.0.0.0:80             DoomServer:0           LISTENING
 Can not obtain ownership information
  TCP    0.0.0.0:110            DoomServer:0           LISTENING
 [hMailServer.exe]
  TCP    0.0.0.0:135            DoomServer:0           LISTENING
  RpcSs
 [svchost.exe]
  TCP    0.0.0.0:143            DoomServer:0           LISTENING
 [hMailServer.exe]
  TCP    0.0.0.0:445            DoomServer:0           LISTENING
 Can not obtain ownership information
  TCP    0.0.0.0:1433           DoomServer:0           LISTENING
 [sqlservr.exe]
  TCP    0.0.0.0:3306           DoomServer:0           LISTENING
 [mysqld.exe]
  TCP    0.0.0.0:3389           DoomServer:0           LISTENING
  TermService
 [svchost.exe]
  TCP    0.0.0.0:8080           DoomServer:0           LISTENING
 Can not obtain ownership information
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:10080          DoomServer:0           LISTENING
 [nginx.exe]
  TCP    0.0.0.0:47001          DoomServer:0           LISTENING
 Can not obtain ownership information
  TCP    0.0.0.0:49152          DoomServer:0           LISTENING
 [wininit.exe]
  TCP    0.0.0.0:49153          DoomServer:0           LISTENING
  eventlog
 [svchost.exe]
  TCP    0.0.0.0:49154          DoomServer:0           LISTENING
  Schedule
 [svchost.exe]
  TCP    0.0.0.0:49155          DoomServer:0           LISTENING
 [lsass.exe]
  TCP    0.0.0.0:49157          DoomServer:0           LISTENING
 [services.exe]
  TCP    0.0.0.0:52309          DoomServer:0           LISTENING
  PolicyAgent
 [svchost.exe]
  TCP    127.0.0.1:14147        DoomServer:0           LISTENING
 [FileZilla Server.exe]
  TCP    127.0.0.1:14147        DoomServer:52055       ESTABLISHED
 [FileZilla Server.exe]
  TCP    127.0.0.1:14147        DoomServer:57096       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57097       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57098       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57099       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57100       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57101       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57102       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57103       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57104       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57105       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57106       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57107       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57108       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57109       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57110       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57111       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57112       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57113       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57114       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57115       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57116       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57117       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57118       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57119       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57120       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57121       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57122       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57123       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57124       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57125       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57126       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57127       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57128       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57129       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57130       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57131       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57132       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57133       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57134       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57135       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57136       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57137       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57138       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57139       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57140       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57141       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57142       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57143       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57145       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57146       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57147       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57148       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57149       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57151       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57152       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57153       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57154       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57155       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57157       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57158       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57161       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57162       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57163       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57167       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57168       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57169       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57170       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57171       TIME_WAIT
  TCP    127.0.0.1:14147        DoomServer:57172       TIME_WAIT
  TCP    127.0.0.1:52055        DoomServer:14147       ESTABLISHED
 [FileZilla Server Interface.exe]
  TCP    127.0.0.1:57159        DoomServer:3306        TIME_WAIT
  TCP    127.0.0.1:60422        DoomServer:60423       ESTABLISHED
 [hMailServer.exe]
  TCP    127.0.0.1:60423        DoomServer:60422       ESTABLISHED
 [hMailServer.exe]
  TCP    188.40.55.84:80        gw:57672               ESTABLISHED
 Can not obtain ownership information
  TCP    188.40.55.84:110       mail-gy0-f131:53479    TIME_WAIT
  TCP    188.40.55.84:139       DoomServer:0           LISTENING
 Can not obtain ownership information
  TCP    188.40.55.84:3389      dtv254:62866           ESTABLISHED
  TermService
 [svchost.exe]
  TCP    188.40.55.84:51899     cds62:http             CLOSE_WAIT
 [Download_for_SQL_Server_2008_R2_Web_(x86_x64_ia64)_DVD_en.exe]
  TCP    188.40.55.84:51901     cds62:http             ESTABLISHED
 [Download_for_SQL_Server_2008_R2_Web_(x86_x64_ia64)_DVD_en.exe]
  TCP    [::]:80                DoomServer:0           LISTENING
 Can not obtain ownership information
  TCP    [::]:135               DoomServer:0           LISTENING
  RpcSs
 [svchost.exe]
  TCP    [::]:445               DoomServer:0           LISTENING
 Can not obtain ownership information
  TCP    [::]:1433              DoomServer:0           LISTENING
 [sqlservr.exe]
  TCP    [::]:3389              DoomServer:0           LISTENING
  TermService
 [svchost.exe]
  TCP    [::]:8080              DoomServer:0           LISTENING
 Can not obtain ownership information
  TCP    [::]:47001             DoomServer:0           LISTENING
 Can not obtain ownership information
  TCP    [::]:49152             DoomServer:0           LISTENING
 [wininit.exe]
  TCP    [::]:49153             DoomServer:0           LISTENING
  eventlog
 [svchost.exe]
  TCP    [::]:49154             DoomServer:0           LISTENING
  Schedule
 [svchost.exe]
  TCP    [::]:49155             DoomServer:0           LISTENING
 [lsass.exe]
  TCP    [::]:49157             DoomServer:0           LISTENING
 [services.exe]
  TCP    [::]:52309             DoomServer:0           LISTENING
  PolicyAgent
 [svchost.exe]
  TCP    [2002:bc28:3754::bc28:3754]:1433  DoomServer:57166       ESTABLISHED
 [sqlservr.exe]
  TCP    [2002:bc28:3754::bc28:3754]:57166  DoomServer:ms-sql-s    ESTABLISHED
 [TfsJobAgent.exe]
  UDP    0.0.0.0:123            *:*
  W32Time
 [svchost.exe]
  UDP    0.0.0.0:500            *:*
  IKEEXT
 [svchost.exe]
  UDP    0.0.0.0:1434           *:*
 [sqlbrowser.exe]
  UDP    0.0.0.0:4500           *:*
  IKEEXT
 [svchost.exe]
  UDP    0.0.0.0:5355           *:*
  Dnscache
 [svchost.exe]
  UDP    127.0.0.1:55354        *:*
 [Download_for_SQL_Server_2008_R2_Web_(x86_x64_ia64)_DVD_en.exe]
  UDP    188.40.55.84:137       *:*
 Can not obtain ownership information
  UDP    188.40.55.84:138       *:*
 Can not obtain ownership information
  UDP    [::]:123               *:*
  W32Time
 [svchost.exe]
  UDP    [::]:500               *:*
  IKEEXT
 [svchost.exe]
  UDP    [::]:1434              *:*
 [sqlbrowser.exe]
  UDP    [::]:4500              *:*
  IKEEXT
 [svchost.exe]
  UDP    [::]:5355              *:*
  Dnscache
 [svchost.exe]

C:\Windows\system32>

答案1

这是一个愚蠢的问题,但是 SQL Server 实际上是否在监听 1433?

例如,如果它是 SQL Express 的命名实例,它可能正在完全监听不同的端口,您需要在连接字符串中指定该端口,在客户端配置中配置该端口,或者运行 SQL Browser 服务并可用于重定向连接。

SQL Browser 服务监听端口 1434。

答案2

您可以使用提升的命令提示符检查 SQL 服务器真正监听的端口,并且:

netstat -a -b

然后,正如 DoomStone 所说,堵塞连接字符串中的端口。

相关内容