简体   繁体   English

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

[英]How to connect database over local area network SQL Server 2008

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 上连接我的数据库我想把它放在局域网上的一台计算机上,这样网络上的任何计算机都可以访问它我该怎么办请给我正确的步骤

In a Client-Server scenario, you will have the SQL Server installed on your server machine.在客户端-服务器方案中,您将在服务器计算机上安装 SQL 服务器。

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 服务器的计算机(可以是 SQL 服务器管理工作室、网络/表单应用程序、Excel 工作表等)。

Each of the client will provide you a way of making a connection to the SQL Server Instance running on the server.每个客户端都会为您提供一种连接到服务器上运行的 SQL 服务器实例的方法。 From server you will need IP Address or Servername along with SQL Server Instance name.从服务器您将需要 IP 地址或服务器名称以及 SQL 服务器实例名称。 They both combined form host name.它们都组合了主机名。

Data Source = ServerName\InstanceName数据源 = ServerName\InstanceName
Note: Instance name not required for default instance.注意:默认实例不需要实例名称。

User name: You need to add user from domain or a sql server authenticated user under security tab (SSMS) on the SQL Server.用户名:您需要在 SQL 服务器上的安全选项卡 (SSMS) 下添加域用户或 sql 服务器认证用户。

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 服务器实例后,不要忘记将用户附加到您希望用户访问的数据库并提供适当的角色。

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

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 服务器计算机 - 在 .NET 中,如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM