Cannot open user default database. Login failed. SQL Server 2005 Express

Posted on 2007-10-03
Medium Priority
Last Modified: 2012-06-27
I am having trouble getting my new webpage online, I am running into the following error...

Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

I have been googling around and have found several responses to this error, but I do not know where to get the program they are referring too, I think it may be with the Full version of SQL Server 2005, when I am using SQL Server 2005 Express....

How to solve my problem can be found here...


Thank you, any ideas are greatly appreciated.
Question by:addicktz
LVL 30

Accepted Solution

nmcdermaid earned 800 total points
ID: 20011598
No its nothing to do with the version.

The Login 'NT AUTHORITY\NETWORK SERVICE' has been added as a login, but it does not have access to the database that is specified as its defauly.

Do you know what database you want to connect to? Either change this users default database to the one you want, or give the user access to the database.

Have you downloaded SQL Management Studio?
LVL 19

Assisted Solution

frankytee earned 400 total points
ID: 20012345
did you restore the db or reattach it from a different server?
sometimes there will be problems if a db is restored before the database users's login was created on the server. if thats the case you'll have to delete the db user, and then assign permission on that user login to that db (which then automatically create the db user again)
LVL 14

Assisted Solution

by:Jai S
Jai S earned 400 total points
ID: 20012456
if you are trying to connect using a FRONT END (like .NET etc) you probably need to specify a database for which the user "NT..." has the permission...

if not then
it appears that the user does not have access to ANY database in the server and it is just the login name that has been created,...
LVL 27

Assisted Solution

ptjcb earned 400 total points
ID: 20013499
Use the SQL Server Management Studio Express > Security > logins.

Right-click on NT Authority\Network Service, select Properties. On the bottom of the General page, instead of Master, choose a database that the service should access (the database used by your Web application).

LVL 30

Assisted Solution

nmcdermaid earned 800 total points
ID: 20020454
....and make sure it actually has access to the db you select, or you will have exactly the same problem. To make sure it has access, in the login screen, go to the second tab and give it access.

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question