如何通过局域网连接数据库 SQL Server 2008

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6667400/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 11:18:02  来源:igfitidea点击:

How to connect database over local area network SQL Server 2008

sqlsql-server-2008

提问by kartal

I want to connect my db on SQL Server 2008 over local area network I want to put it on one computer on the LAN so any computer on the network can access it what should I do please give me correct steps

我想通过局域网连接我在 SQL Server 2008 上的数据库我想把它放在局域网上的一台计算机上,这样网络上的任何计算机都可以访问它我该怎么做,请给我正确的步骤

回答by Santosh Chandavaram

In a Client-Server scenario, you will have the SQL Server installed on your server machine.

在客户端-服务器方案中,您将在服务器计算机上安装 SQL Server。

Clients will be the computers accessing that SQL Server using a client software (can be SQL Server Management Studio, web/forms application, Excel worksheet, etc).

客户端将是使用客户端软件(可以是 SQL Server Management Studio、Web/表单应用程序、Excel 工作表等)访问该 SQL Server 的计算机。

Each of the client will provide you a way of making a connection to the SQL Server Instance running on the server. From server you will need IP Address or Servername along with SQL Server Instance name. They both combined form host name.

每个客户端都会为您提供一种连接到服务器上运行的 SQL Server 实例的方法。从服务器,您将需要 IP 地址或服务器名称以及 SQL Server 实例名称。它们都组合形成主机名。

Data Source = ServerName\InstanceName
Note: Instance name not required for default instance.

数据源 = ServerName\InstanceName
注意:默认实例不需要实例名称。

User name: You need to add user from domain or a sql server authenticated user under security tab (SSMS) on the SQL Server.

用户名:您需要在 SQL Server 上的安全选项卡 (SSMS) 下添加域中的用户或 sql server 身份验证的用户。

Password: Corresponding password.

密码:对应的密码。

Note: Once you add a user to SQL Server Instance, do not forget to attach the user to databases you want the user to access and provide appropriate role(s).

注意:将用户添加到 SQL Server 实例后,不要忘记将该用户附加到您希望该用户访问的数据库并提供适当的角色。

回答by marc_s

  1. Install SQL Server 2008 on one machine on your LAN (let's call it SQLServer)
  2. Connect that machine to the LAN (network cable)
  3. You're done.
  1. 在 LAN 上的一台机器上安装 SQL Server 2008(我们称之为SQLServer
  2. 将该机器连接到 LAN(网线)
  3. 你完成了。

Now, all other computers can connect to that SQL Server machine by its name in the connection string - in .NET, that would look like:

现在,所有其他计算机都可以通过连接字符串中的名称连接到该 SQL Server 计算机 - 在 .NET 中,如下所示:

server=SQLServer;database=YourDatabase;User ID=YourUser;Pwd=top$Secret