从域身份验证过渡到 SQL Server 身份验证

发布于 2024-10-10 01:14:27 字数 739 浏览 0 评论 0原文

大家好,我遇到了一个困扰我的问题。

我已经在 SQL Server Express 中构建了一个数据库,但遇到了一个奇怪的权限问题。 该数据库位于我的开发计算机上,域用户为:DOMAIN\albertp。 我的开发数据库服务器设置为“SQL Server 和 Windows 身份验证”模式。 当我使用 Windows 身份验证登录时,我可以毫无问题地编辑和查询数据库。

但是,当我登录到使用 SQL Server 身份验证(包括 sa)的任何用户时,当我对数据库运行查询时,我会收到此消息。

SELECT * FROM [Testing].[dbo].[AuditingReport]

我得到:

Msg 18456, Level 14, State 1, Line 1
Login failed for user 'auditor'.

我以“审核员”身份从 SQL Server Management Studio 登录到服务器,并且在错误日志中没有看到有关登录失败的任何内容。

我已经运行了:

Use Testing;
Grant All to auditor;
Go

但我仍然遇到同样的错误。我必须设置哪些权限才能使数据库可供我个人域登录之外的其他人使用? 或者我看错了问题?

我的最终目标是使用通用登录名(因此为“审核员”)或特定于一组单独用户的登录名,从一组 PHP 页面访问数据库。

Greetings all, I've run into a problem that has me stumped.

I've put together a database in SQL Server Express, and I'm having a strange permissions problem.
The database is on my development machine with a domain user: DOMAIN\albertp.
My development database server is set for "SQL Server and Windows Authentication" mode.
I can edit and query my database without any problems when I log in using Windows Authentication.

However, when I log in to any user that uses SQL Server authentication (Including sa) I get this message when I run queries against my database.

SELECT * FROM [Testing].[dbo].[AuditingReport]

I get:

Msg 18456, Level 14, State 1, Line 1
Login failed for user 'auditor'.

I'm logged into the server from SQL Server Management Studio as 'auditor' and I don't see anything in the error log about the login failure.

I've already run:

Use Testing;
Grant All to auditor;
Go

And I still get the same error. What permissions do I have to set for the database to be usable by others outside of my personal domain login?
Or am I looking at the wrong problem?

My ultimate goal is to have the database be accessible from a set of PHP pages, using a either a common login (hence 'auditor') or a login specific to a set of individual users.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

难忘№最初的完美 2024-10-17 01:14:27

GRANT ALL 未执行该操作你相信它是。

出于测试目的,我建议您考虑使用数据库角色来管理用户的权限。

以下是可用数据库级角色的列表,

您可以添加使用系统存储过程 sp_AddRoleMember 将现有用户授予数据库级角色。例如,以下内容将为您的用户提供对给定数据库中所有对象的读取权限。:

EXEC sp_addrolemember 'db_datareader','auditor'

理想情况下,您可能需要考虑定义自己的数据库角色,以便管理数据库用户的权限。

GRANT ALL is not performing the action you believe it to be.

I suggest for testing purposes that you consider using Database Roles in order to manage the privileges of your User.

Here is a list of the available Database-Level Roles

You can add an existing User to a Database Level role by using the system stored procedure sp_AddRoleMember. For example, the following will provide READ permission to your User for all objects within the given database.:

EXEC sp_addrolemember 'db_datareader','auditor'

Ideally, you will likely want to consider defining your own Database Roles in order to manage privileges for your Database Users.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文