为 SQL Server Express 2012 启用远程连接 [英] Enable remote connections for SQL Server Express 2012

查看:31
本文介绍了为 SQL Server Express 2012 启用远程连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在我的家庭服务器上安装了 SQL Server Express 2012.我正在尝试从我的台式机上的 Visual Studio 2012 连接到它,并反复收到众所周知的错误:

I just installed SQL Server Express 2012 on my home server. I'm trying to connect to it from Visual Studio 2012 from my desktop PC, and repeatedly getting the well-known error:

与 SQL Server 建立连接时发生与网络相关或特定于实例的错误.服务器未找到或无法访问.验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接.(提供程序:命名管道提供程序,错误:40 - 无法打开与 SQL Server 的连接)

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

我做了什么来尝试解决这个问题:

What I've done to try to fix this:

  • 在服务器上运行 SQL Server 配置管理器并启用 SQL Server 浏览器
  • 在服务器上为本地子网上的 TCP、端口 1433 和 1434 添加 Windows 防火墙例外.
  • 验证我是否在 SQL Server 实例上为我在桌面上登录的用户登录.
  • 验证我是否在 SQL Server 实例上使用了 Windows 身份验证.
  • 反复重启 SQL Server 和整个 dang 服务器.
  • 拔掉我所有的头发.

如何让 SQL Server 2012 Express 允许远程连接!?

推荐答案

好吧,很高兴我问了.我最终发现的解决方案在这里:

Well, glad I asked. The solution I finally discovered was here:

如何配置 SQL Server Express 以允许端口 1433 上的远程 tcp/ip 连接?

  1. 运行 SQL Server 配置管理器.
  2. 转到 SQL Server 网络配置 > SQLEXPRESS 的协议.
  3. 确保 TCP/IP 已启用.

到目前为止,一切都很好,完全符合预期.但随后:

So far, so good, and entirely expected. But then:

  1. 右键单击 TCP/IP 并选择属性.
  2. 验证在 IP2 下,IP 地址是否设置为本地子网上的计算机 IP 地址.
  3. 向下滚动到 IPAll.
  4. 确保TCP 动态端口空白.(我的设置为一些 5 位数的端口号.)
  5. 确保TCP 端口 设置为1433.(我的是空白.)
  1. Right-click on TCP/IP and select Properties.
  2. Verify that, under IP2, the IP Address is set to the computer's IP address on the local subnet.
  3. Scroll down to IPAll.
  4. Make sure that TCP Dynamic Ports is blank. (Mine was set to some 5-digit port number.)
  5. Make sure that TCP Port is set to 1433. (Mine was blank.)

(此外,如果您按照这些步骤操作,则不需要启用 SQL Server Browser,您只需要允许端口 1433,而不是 1434.)

(Also, if you follow these steps, it's not necessary to enable SQL Server Browser, and you only need to allow port 1433, not 1434.)

这额外的五个步骤是我不记得在以前版本的 SQL Server、Express 或其他版本中必须做的事情.它们似乎是必需的,因为我在服务器上使用命名实例 (myservername\SQLEXPRESS) 而不是默认实例.看这里:

These extra five steps are something I can't remember ever having had to do in a previous version of SQL Server, Express or otherwise. They appear to have been necessary because I'm using a named instance (myservername\SQLEXPRESS) on the server instead of a default instance. See here:

配置服务器以侦听特定 TCP 端口(SQL Server 配置管理器)

这篇关于为 SQL Server Express 2012 启用远程连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆