How to resolve the "Cannot open database, user NT Authority\Network SERVICE login failed" error?

Source: Internet
Author: User
Tags management studio sql server management sql server management studio
1

The Network Service account is a built-in account that has more access to resources and objects than members of the Users group. A service running as the Network Service account accesses network resources using the credentials of the computer account. The actual name of the account is "NT authority\network SERVICE".

How to solve this situation?

Method One (Management Studio User Interface):
Open SQL Server Management Studio, click Security and Logins, right-click NT Authority\Network SERVICE, select Properties. (Add this login if there is no NT Authority\Network SERVICE)
On the Login Properties page that opens, click User Mapping. On the "User Mapping" page, select the database you want to connect to, at the bottom of this page, select db_owner role and click OK.

Method Two (T-SQL):

1. Add the user NT Authority\Network Service to SQL Login. (So the user is already in SQL login, omit this step)
EXEC sp_grantlogin N ' NT authority\network SERVICE '
GO
2. Assign the permissions of db_owner to NT Authority\Network SERVICE.
Use Your_db_name
GO
EXEC sp_addrolemember ' db_owner ', N ' NT authority\network SERVICE '
GO

How to resolve the "Cannot open database, user NT Authority\Network SERVICE login failed" error?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.