无法连接到 SQL Server 2008 Express 实例

发布于 2024-09-08 17:53:43 字数 1225 浏览 3 评论 0原文

我有一个 SQL Server 2008 实例和一个 SQL Server 2008 Express 实例。

我主要使用带有以下连接字符串的 SQL Server 2008 实例...

<add name="Local-DB-connection" connectionString="Data Source=JONATHAN-PC; Database=dbname; User ID=uname; Password=pword;" providerName="System.Data.SqlClient" />

这工作正常。

现在在 Express 的实例上,我有一个具有相同名称和相同数据库的用户,但无论什么我总是收到此错误,

Cannot open database "dbName" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

现在我在 Express 连接字符串上添加了 - Trusted_Connection=True ,因此,NT AUTHORITY\NETWORK SERVICE

我找到了一个论坛帖子,我在修复实时服务器上的类似问题时使用过该帖子

http:// /blog.sqlauthority.com/2009/08/20/sql-server-fix-error-cannot-open-database-requested-by-the-login-the-login-failed-login-failed-for-user-nt -authoritynetwork-service/

它基本上讨论添加 NT AUTHORITY\NETWORK SERVICE' 用户,但该用户不在要添加的列表中。

我在这里疯了,我怀疑这与我的两个 SQL Server 实例冲突有关,

有人能解释一下吗?

谢谢特鲁吉利

i have an instance of SQL server 2008 and an instance of SQL server 2008 Express.

i have been mainly using the SQL server 2008 instance with the following connection string...

<add name="Local-DB-connection" connectionString="Data Source=JONATHAN-PC; Database=dbname; User ID=uname; Password=pword;" providerName="System.Data.SqlClient" />

this works fine.

now on the instance of express, i have a user with the same name and a identical database, but no matter what i always get this error

Cannot open database "dbName" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

now i have added - Trusted_Connection=True on the express connection string, hence the NT AUTHORITY\NETWORK SERVICE

i have found a forum post which i have used when fixing a similar issues on my live server

http://blog.sqlauthority.com/2009/08/20/sql-server-fix-error-cannot-open-database-requested-by-the-login-the-login-failed-login-failed-for-user-nt-authoritynetwork-service/

it basically talks about adding the NT AUTHORITY\NETWORK SERVICE’ user, but this user is not in the list to add.

im going nuts here, and im suspecting its to do with my two SQL server instances conflicting

can anyone shed some light on this ??

thanks

truegilly

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

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

发布评论

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

评论(1

掐死时间 2024-09-15 17:53:43

只是为了检查一下,您是否正在尝试使用正确的实例名称(即 JONATHAN-PC\SQLEXPRESS 或类似名称)访问 SQL Express 数据库?

网络服务应该在列表中。如果您转到

  • “安全”、“登录”、“新登录”、“搜索”、“高级”,
  • 在“位置”框中选择您的电脑(除非您位于域中,否则应为默认设置),
  • 然后“立即查找”

,那么它应该作为“网络服务”出现在列表中。如果您选择它,它将出现在 NT AUTHORITY 中。

将其添加到列表中后,您需要授予其访问数据库的权限。您的链接建议将其设置为 db_owner - 这对生产来说是危险的,您应该将其权限削减到更受限制的集合,但对于开发和证明它的工作可能没问题。

Just to check, you're trying to access the SQL Express database with the correct instance name, i.e. JONATHAN-PC\SQLEXPRESS or similar?

NETWORK SERVICE should be in the list. If you go to

  • Security, Logins, New Login, Search, Advanced
  • Select your PC in the Locations box (should be default unless you're on a domain)
  • Find now

then it should be in the list as NETWORK SERVICE. If you select that it'll then appear in NT AUTHORITY.

Once you've got it in your list you'll need to grant it access to your database. Your link suggests setting it as db_owner - that's dangerous for production, you should cut its permissions down to a more restricted set, but for development and proof-it's-working that's probably OK.

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