Details
Product:SQL Server
ID:4064
Source:MSSQLServer
Version:10.0
Component:SQLEngine
Symbolic Name:DB_UFAIL_FATAL
Message:Cannot open user default database. Login failed.
   
Explanation

The SQL Server login was unable to connect because of a problem with its default database. Either the database itself is invalid or the login lacks CONNECT permission on the database.

   
User Action

Use ALTER LOGIN to change the login's default database. Grant CONNECT permission to the login.

   
   
Version:9.00.1281.60
Symbolic Name:DB_UFAIL_FATAL
Message:Cannot open user default database. Login failed.
   
Explanation

The default database for this login is invalid, or the login lacks correct permissions.

   
User Action

Use ALTER LOGIN to change the default database to a valid database for which the user has appropriate permissions.

   
   
Version:9.0
Component:SQLEngine
Symbolic Name:DB_UFAIL_FATAL
Message:Cannot open user default database. Login failed.
   
Explanation

The SQL Server login was unable to connect because of a problem with its default database. Either the database itself is invalid or the login lacks CONNECT permission on the database.

   
User Action

Use ALTER LOGIN to change the login's default database. Grant CONNECT permission to the login.

   
   
Version:8.0
Component:SQL Engine
Message:Cannot open user default database. Login failed.
   
Explanation
When a client connects to a SQL Server instance without specifying a database context, the default database defined for its login is used. If that database is unavailable for any reason, the above message appears.

Note: If the login is a member of one or more Windows groups that are also defined as logins within SQL Server, the default database for one of those groups may be used. There is not a reliable way to predict which of the default databases will be chosen during a login attempt. Therefore it is important to check group membership for the login account and then check the default database set for all groups to see that they are all available.

   
User Action
You need to either make the default database accessible or avoid using that particular database. Your options include:

  • Change your connection string to always specify a particular database.
  • Verify that the default database defined for each login still exists and is accessible. Review the SQL Server error log to help determine why a particular database is not accessible.
  • Use a tool such as OSQL to specify a particular database during the initial connection. Once you are connected, execute sp_defaultdb to change the default database for your login to a database that is currently accessible.
  • Log in with an account that is a member of the syadmin or securityadmin fixed server roles, and execute sp_defaultdb to change the default database for the failing login to an accessible database.
  • For more information about default databases, see "sp_defaultdb" in Books Online and the Microsoft Knowledge Base articles 307864 and 196076.