windows 如何连接到 SQL Server 2008
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/469215/
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
How to connect to SQL Server 2008
提问by Bobby Ortiz
I have a desktop, and a Laptop. The Desktop has Windows 7 64-bit and the Laptop has Vista Ultimate 32-bit. On both machines I have SQL Server 2008 Standard installed. On the laptop, I open SQL Management Studio and try to connect to the SQL Server on the desktop. It times out.
我有一台台式机和一台笔记本电脑。桌面有 Windows 7 64 位,笔记本电脑有 Vista Ultimate 32 位。我在两台机器上都安装了 SQL Server 2008 Standard。在笔记本电脑上,我打开 SQL Management Studio 并尝试连接到桌面上的 SQL Server。它超时了。
With SQL Server Config Manager I Enabled TCP/IP and Named Pipes for the client protocols.
使用 SQL Server 配置管理器,我为客户端协议启用了 TCP/IP 和命名管道。
In SQL Management Studio, I right clicked on the Database Engine, went to properties, and allowed remote connections. I also created a sql server login named "testuser" and a password. I then added that user as a login for my database and made them the database owner.
在 SQL Management Studio 中,我右键单击数据库引擎,转到属性,并允许远程连接。我还创建了一个名为“testuser”的 sql server 登录名和一个密码。然后我将该用户添加为我的数据库的登录名,并使他们成为数据库所有者。
I could not figure out how to allow connection to my db throw the windows firewall, so I turned it off.
我无法弄清楚如何允许连接到我的数据库抛出 Windows 防火墙,所以我将其关闭。
What am I missing? I made the same changes on my laptop, and I can connect from the Desktop to the Laptop in Management Studio?
我错过了什么?我在笔记本电脑上做了同样的更改,我可以在 Management Studio 中从台式机连接到笔记本电脑吗?
Do you have a checklist? Thanks.
你有清单吗?谢谢。
UPDATE: I turned off antivirus. Ran NetStat -a and the listener is listening.
更新:我关闭了防病毒软件。Ran NetStat -a 并且侦听器正在侦听。
回答by SqlRyan
If your login attempt takes about 30 seconds to timeout, then it's some kind of network connectivity problem (or SQL isn't listening properly). A permissions problem would come back after a few seconds, so the long wait says it's connection-related.
如果您的登录尝试超时大约需要 30 秒,那么这是某种网络连接问题(或 SQL 未正确侦听)。几秒钟后,权限问题会再次出现,因此长时间的等待表明它与连接相关。
If you run "NETSTAT -a" on the server, so you see SQL Server listening on port 1433? If not, then maybe the SQL TCP Listener isn't configured properly on the server - there should be events in the Windows Event log to this effect when the SQL Service starts up.
如果您在服务器上运行“NETSTAT -a”,那么您看到 SQL Server 正在侦听端口 1433?如果不是,则可能是服务器上的 SQL TCP 侦听器配置不正确 - 当 SQL 服务启动时,Windows 事件日志中应该有与此相关的事件。
Please edit your question with the results and we can go from there.
请用结果编辑您的问题,我们可以从那里开始。
回答by SqlRyan
Try using Telnet to see if the laptop can see the desktop via port 1433.
试试用Telnet看看笔记本能不能通过1433端口看到桌面。
Open a command prompt on the laptop and enter:
在笔记本电脑上打开命令提示符并输入:
telnet DesktopNameOrIPAddress 1433
Press Enter, and you should either see a connection failed error, or a blank screen. If you get the blank screen, the connection was established. Press CTRL-] to break out of it, then type "quit" and enter to quit.
按 Enter,您应该会看到连接失败错误或空白屏幕。如果出现空白屏幕,则表明连接已建立。按 CTRL-] 退出它,然后输入“quit”并回车退出。
If the connection failed, attempt to resolve the general network issue with port 1433 before bothering to use the SQL Server tools.
如果连接失败,请尝试解决端口 1433 的一般网络问题,然后再使用 SQL Server 工具。
回答by Mark Ransom
If you have any other anti-virus software running, it may also have a firewall built in. I know that McAfee does, for instance. Check for that.
如果您正在运行任何其他防病毒软件,它也可能内置了防火墙。例如,我知道 McAfee 有。检查一下。
回答by Jonathan
You've probably already thought of this, but have you checked that the server is configured to allow Mixed Mode Authentication? I have not had access to 2008, but I seem to remember that at least one of the previous versions was configured to disallow sql logins by default.
您可能已经想到了这一点,但是您是否检查过服务器配置为允许混合模式身份验证?我没有访问 2008,但我似乎记得至少有一个以前的版本被配置为默认禁止 sql 登录。
回答by MarlonRibunal
I assume you already did what you have to do on the OS level. Or maybe tried to link the server to see if you can actually traverse your network. Let me suggest a quick test. Check if you can actually test connectivity by creating a Universal Data Link. In case you don't know how to do this, create a new text file in your desktop (or anywhere) and change the .txt file extension to .udl; then just open it. See if your other server is "viewable" over the network (Don't forget to change the Provider to OLE DB Provider for SQL Server).
我假设您已经在操作系统级别做了您必须做的事情。或者可能尝试链接服务器以查看您是否可以真正遍历您的网络。让我建议一个快速测试。检查您是否可以通过创建通用数据链路来实际测试连接性。如果您不知道如何执行此操作,请在您的桌面(或任何地方)创建一个新的文本文件并将 .txt 文件扩展名更改为 .udl;然后打开它。查看您的其他服务器是否可以通过网络“查看”(不要忘记将提供程序更改为 SQL Server 的 OLE DB 提供程序)。
回答by Jeroen Landheer
Is the SQL Browser Service running on the server you are trying to access? (By default this is disabled, and you'll need that to access SQL Server remotely)
SQL Browser 服务是否在您尝试访问的服务器上运行?(默认情况下这是禁用的,您需要它来远程访问 SQL Server)