配置 SQL Server 2016 以允许远程连接

Mik*_*sen 7 sql-server windows-server sql-server-2016

我在 Windows Server 2016 Core 上安装了 SQL Server 2016。在本地,它似乎有效。我可以连接使用SQLCMD.exe并做一些基本的选择,什么不是。

从远程,我无法连接。使用SQLCMD.exe远程计算机上:

sqlcmd -S boldiq_db3
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Named Pipes 
    Provider: Could not open a connection to SQL Server [53]. .
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Login timeout 
    expired.
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : A network-related
    or instance-specific error has occurred while establishing a connection 
    to SQL Server. Server is not found or not accessible. Check if instance 
    name is correct and if SQL Server is configured to allow remote 
    connections. For more information see SQL Server Books Online..
Run Code Online (Sandbox Code Playgroud)

来自 SQL Server Management Studio:

在此处输入图片说明

在我安装的安装 INI 中,我有:

TCPENABLED=1

所以,我相信 TCP 已启用。这可能是防火墙问题,但我已经运行:

netsh advfirewall firewall add rule name = SQLPort dir = in protocol = tcp action = allow localport = 1433 remoteip = localsubnet profile = DOMAIN

这似乎已成功完成。是否还有其他步骤可以诊断问题发生的位置?谢谢!

Mik*_*sen 5

弄清楚了!由于服务器运行在远程 VMWare ESXi 实例上,因此子网完全不同。我变了:

netsh advfirewall firewall add rule name = SQLPort dir = in protocol = tcp action = allow localport = 1433 remoteip = localsubnet profile = DOMAIN

到:

netsh advfirewall firewall add rule name = SQLPort dir = in protocol = tcp action = allow localport = 1433 remoteip = any profile = DOMAIN

一切都立即开始工作。呃,防火墙。