0

我想知道是否可以将 SQL Server 身份验证帐户更改为 Windows 身份验证?

我为什么要这样做你现在问自己,我不想给多个用户提供 SQL Server Auth 用户名和密码来连接到数据库,目前公司这样做,我们不真的别无选择。当我们部署一个新的数据库脚本时,我们并不总是在它发布之前拥有 Windows Auth 帐户,并且我们不想更新我们的部署脚本。

我正在尝试使用

ALTER USER Test  
WITH NAME = [mydomianname\username]`

我已经尝试过了,但没有运气。

我不断收到此错误:

消息 15151,级别 16,状态 1,行 1
无法更改用户“测试”,因为它不存在或您没有权限。

先感谢您!

4

1 回答 1

0

I think you should be altering user with login not name, because with name you just rename the user:

ALTER USER Test WITH LOGIN = [mydomianname\username]

But it is impossible because of:

Cannot remap a user of one type to a login of a different type. For example, a SQL user must be mapped to a SQL login; it cannot be remapped to a Windows login.

于 2015-03-25T14:34:10.123 回答