使用用户名和密码连接到 SQL Server [英] Connecting to SQL Server with a username and password

查看:39
本文介绍了使用用户名和密码连接到 SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个要部署在另一台机器上的 C# 应用程序.部署机器是一个干净的 Windows 7 安装.

I am writing a C# application to be deployed on another machine. The deploy machine is a clean Windows 7 install.

在我的开发机器(Windows 7 32 位虚拟机)上,我安装了 SQL Server 2008 R2 和 Visual Studio Express 2010.我想创建一个新数据库,并让它需要来自应用程序的身份验证才能连接.我发现的所有教程都提到了连接字符串部分的微风,我找不到任何地方对此进行解释.事实上,我什至不知道如何在 SQL Server Management Studio 中向 SQL Server 添加新用户和密码.

On my development machine (A Windows 7 32 bit Virtual Machine) I have installed SQL Server 2008 R2 and Visual Studio Express 2010. I would like to create a new database and have it require authentication from an application to connect. All the tutorials that I find mention breeze over the connection string part, I cannot find this explained anywhere. In fact, I cannot even figure out how to add a new user and password to SQL Server in SQL Server Management Studio.

如何将新用户和密码添加到 SQL Management Studio 2008 R2,以便我可以轻松地在另一台机器上安装另一个 SQL Server 实例并将数据库移动到其中?

How do I add a new user and password to SQL Management Studio 2008 R2 such that I can easily install another SQL Server instance on another machine and move the database to it?

谢谢.

推荐答案

首先检查你的数据库的认证模式:在 SSMS 上连接到您的数据库,右键单击它,转到属性",然后转到安全性".确保选择了SQL Server 和 Windows 身份验证模式".这将允许您创建登录名.

first check the authentication mode of your DB: connect to your DB on SSMS, right click it, go to "properties" and then "security". Make sure that "SQL Server and windows authentication mode" is selected. That will allow you to create logins.

然后创建您的登录名:在 SSMS 上连接到您的数据库,展开您的数据库,然后转到安全"并右键单击登录名,然后单击新登录名"

Then create your login: connect to your DB on SSMS, expand your database then go to "security" and right click on logins and then click "new login"

然后创建您的用户:转到数据库内的安全文件夹,右键单击用户和新用户".告知您之前创建的用户名和登录名.不要忘记添加必要的权限

then create your user: go to the security folder inside your DB, right click users and "new user". Inform the user name and the login name you previous created. Dont forget to add the necessary permissions

关于连接字符串,这是一个已经指出的非常好的网站:

About connection strings, this is a very good website as already pointed:

http://www.connectionstrings.com/

这篇关于使用用户名和密码连接到 SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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