Login With Bad Default Database

When a user’s login is set to default to a database that no longer exists, the following behavior occurs:

  1. Default Database Unavailability:
    • If the default database specified for a login does not exist or is inaccessible, the login still successfully connects to the SQL Server instance.
    • The login process does not fail due to the missing default database.
  2. Access to Other Databases:
    • Even though the default database is unavailable, the user can still log in to other databases they are mapped to on the same SQL Server instance.
    • The login process checks the user’s permissions and mappings for the target database, regardless of the default database setting.
    • If the user has appropriate permissions and mappings for another database, they can access it without any issues.
  3. Mapping to an Existing Default Database:
    • Contrary to common perception, the mapping of a user to an existing default database is not a prerequisite for login to any other database.
    • The default database setting only affects the initial connection and context for the user. Once connected, the user can switch to other databases.

In summary, the default database setting does not impact the user’s ability to log in to other databases they are mapped to. As long as the user has valid permissions and mappings, they can access other databases on the same SQL Server instance, even if the default database is nonexistent or inaccessible.


Enroll Today!
SteveStedman5
SteveStedman5
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!