如何从另一台计算机连接到 SQL Server?

发布于 2024-08-26 08:06:55 字数 133 浏览 2 评论 0原文

我想使用 SQL Server 2005 从家里连接到另一台 PC。

我查看了 msd...但在连接之前它说我应该连接到另一台计算机 使用计算机管理但没有成功......我只能连接到我的工作组中的计算机?

谢谢, 路易莎

I want to connect from home using SQL Server 2005 to another PC.

I had a look on the msd...but before connecting it says I should connect to another computer
using the computer management and it didn't work out....I can only connect to computers from my workgroup?

Thanks,
Luisa

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

萤火眠眠 2024-09-02 08:06:55

免责声明

这只是一些可能对任何人都有帮助的附加信息。我想非常清楚地表明,我在这里描述的内容可能是:

  • A. 不是 100% 正确,
  • B. 在网络安全方面不安全。

我不是 DBA,但每次我发现自己设置 SQL Server(Express 或 Full)进行测试或其他什么情况时,我都会遇到连接问题。我描述的解决方案更适合那些只是想完成工作的人 - 在设置生产服务器时咨询该领域知识渊博的人。

对于 SQL Server 2008 R2,这就是我最终要做的事情:

  1. 确保所有内容都像这样排列整齐
    教程 其中与上面发布的教程相同,作为“Dani”的解决方案,作为该问题的选定答案。
  2. 检查和/或设置托管 SQL Server 的计算机的防火墙设置。如果您使用的是 Windows Server 2008 R2,则使用服务器管理器,转到“配置”,然后查看“具有高级安全性的 Windows 防火墙”。如果您使用的是 Windows 7,请转至控制面板并搜索“防火墙”,然后单击“允许程序通过 Windows 防火墙”。
    • 为端口 TCP 1433 创建入站规则 - 允许连接
    • 为端口 TCP 1433 创建出站规则 - 允许连接
  3. 当您完成防火墙设置后,您还需要检查一件事。打开“SQL Server 配置管理器”,找到:SQL Server 网络配置 - SQLEXPRESS 协议(或同等协议) - TCP/IP
    • 双击 TCP/IP
    • 点击“IP 地址”选项卡
    • 在 IP1 下,将 TCP 端口设置为 1433(如果尚未设置)
    • 在“IP All”下,将 TCP 端口设置为 1433(如果尚未设置)
  4. 重新启动 SQL Server和 SQL 浏览器(两者都做只是为了安全起见)

通常在我做了上面提到的事情之后我就不再有问题了。下面是最后一步要查找的内容的屏幕截图:

Port 1433 是 SQL Server 使用的默认端口,但对于某些默认情况下,原因不会显示在配置中。

同样,如果了解有关此主题的更多信息的人看到危险信号,请纠正我。

Disclamer

This is just some additional information that might help anyone. I want to make it abundantly clear that what I am describing here is possibly:

  • A. not 100% correct and
  • B. not safe in terms of network security.

I am not a DBA, but every time I find myself setting up a SQL Server (Express or Full) for testing or what not I run into the connectivity issue. The solution I am describing is more for the person who is just trying to get their job done - consult someone who is knowledgeable in this field when setting up a production server.

For SQL Server 2008 R2 this is what I end up doing:

  1. Make sure everything is squared away like in this
    tutorial which is the same tutorial posted above as a solution by "Dani" as the selected answer to this question.
  2. Check and/or set, your firewall settings for the computer that is hosting the SQL Server. If you are using a Windows Server 2008 R2 then use the Server Manager, go to Configuration and then look at "Windows Firewall with Advanced Security". If you are using Windows 7 then go to Control Panel and search for "Firewall" click on "Allow a program through Windows Firewall".
    • Create an inbound rule for port TCP 1433 - allow the connection
    • Create an outbound rule for port TCP 1433 - allow the connection
  3. When you are finished with the firewall settings you are going to want to check one more thing. Open up the "SQL Server Configuration Manager" locate: SQL Server Network Configuration - Protocols for SQLEXPRESS (or equivalent) - TCP/IP
    • Double click on TCP/IP
    • Click on the IP Addresses tab
    • Under IP1 set the TCP Port to 1433 if it hasn't been already
    • Under IP All set the TCP Port to 1433 if it hasn't been already
  4. Restart SQL Server and SQL Browser (do both just to be on the safe side)

Usually after I do what I mentioned above I don't have a problem anymore. Here is a screenshot of what to look for - for that last step:

Port 1433 is the default port used by SQL Server but for some reason doesn't show up in the configuration by default.

Again, if someone with more information about this topic sees a red flag please correct me.

吻风 2024-09-02 08:06:55

如果您想远程连接到 SQL Server,您需要使用 Sql Server Management studio 等软件。

计算机不需要位于同一网络上 - 但它们必须能够使用 tcp/ip 等通信协议相互连接,并且必须将服务器设置为支持您选择类型的传入连接。

如果您想连接到另一台计算机(浏览文件?),您可以使用其他工具,而不是 sql server(您可以映射驱动器并通过那里访问它等...)

要使用 tcp/ip 启用 SQL 连接,请阅读这篇文章:

对于 Sql Express:express
对于 Sql 2008:2008

确保通过计算机防火墙启用访问出色地。

您可能需要在用于连接服务器的计算机上安装 SSMS 或 Toad。您都可以从他们的公司网站下载。

If you want to connect to SQL server remotly you need to use a software - like Sql Server Management studio.

The computers doesn't need to be on the same network - but they must be able to connect each other using a communication protocol like tcp/ip, and the server must be set up to support incoming connection of the type you choose.

if you want to connect to another computer (to browse files ?) you use other tools, and not sql server (you can map a drive and access it through there ect...)

To Enable SQL connection using tcp/ip read this article:

For Sql Express: express
For Sql 2008: 2008

Make sure you enable access through the machine firewall as well.

You might need to install either SSMS or Toad on the machine your using to connect to the server. both you can download from their's company web site.

甜心 2024-09-02 08:06:55

我将根据提供的进一步信息编辑我之前的答案。您可以清楚地 ping 远程计算机,因为您可以使用终端服务。

我感觉 1433 端口被防火墙阻止了,所以给你带来了麻烦。请参阅 Microsoft 的通过防火墙与 SQL Server 通信所需的 TCP 端口

尝试使用应用程序来 ping 您的服务器 IP 地址和端口 1433。

tcping your.server.ip.address 1433

看看您是否从 tcping 获得“端口已打开”响应。

好的,接下来要尝试的是检查 SQL Server。 RDP 到 SQL Server 计算机。启动SSMS。连接到数据库。在对象资源管理器(通常停靠在左侧)中,右键单击服务器,然后单击属性。

替代文本 http://www.hicrest.net/server_prop_menu.jpg

转到连接设置并确保“允许远程连接到此服务器”是票证。

替代文本 http://www.hicrest.net/server_properties.jpg

I'll edit my previous answer based on further info supplied. You can clearely ping the remote computer as you can use terminal services.

I've a feeling that port 1433 is being blocked by a firewall, hence your trouble. See TCP Ports Needed for Communication to SQL Server Through a Firewall by Microsoft.

Try using this application to ping your servers ip address and port 1433.

tcping your.server.ip.address 1433

And see if you get a "Port is open" response from tcping.

Ok, next to try is to check SQL Server. RDP onto the SQL Server computer. Start SSMS. Connect to the database. In object explorer (usually docked on the left) right click on the server and click properties.

alt text http://www.hicrest.net/server_prop_menu.jpg

Goto the Connections settings and make sure "Allow remote connections to this server" is ticket.

alt text http://www.hicrest.net/server_properties.jpg

睡美人的小仙女 2024-09-02 08:06:55

以上所有答案都会对您有所帮助,但您必须在安装 SQL Server 的 PC 的防火墙中添加三个端口。

  1. 在 Windows 防火墙中添加新的 TCP 本地端口,端口号为 1。 1434

  2. 为 SQL Server 添加新程序并选择 sql server.exe
    路径:C:\ProgramFiles\Microsoft SQL
    Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\sqlservr.exe

  3. 为 SQL Browser 添加新程序并选择 sqlbrowser.exe
    路径:C:\ProgramFiles\Microsoft SQL Server\90\Shared\sqlbrowser.exe

all of above answers would help you but you have to add three ports in the firewall of PC on which SQL Server is installed.

  1. Add new TCP Local port in Windows firewall at port no. 1434

  2. Add new program for SQL Server and select sql server.exe
    Path: C:\ProgramFiles\Microsoft SQL
    Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\sqlservr.exe

  3. Add new program for SQL Browser and select sqlbrowser.exe
    Path: C:\ProgramFiles\Microsoft SQL Server\90\Shared\sqlbrowser.exe

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文