Home Forums SQL Server 2008 SQL Server Newbies Do Users based on logins in master have access to other databases? RE: Do Users based on logins in master have access to other databases?

  • clintonG (3/14/2013)


    When I create a user and select master as the default database does that mean or imply that user can login to other databases on the same instance of SQLExpress 2012? If so how is a user created that can only login to a specific database?

    I understand a User can be mapped to a specific database but in certain circumstances the User must be created manually --before the database-- because the database the User is logging into is being generated by a sql script generated by a tool; Visual Studio LightSwitch 2012 to be specific.

    Lots of generation going on except in my brain. lol

    Only a login can have the "default_database" setting, a user cannot. Default database setting let you choose a database which this login will be connected to whenever he logins into SQL Server (If the user has not specified any database name explicitly).

    Logins & Users are completely different from each other. Logins are create at server scope whereas users are created in database scope.

    So, You can create users only after the database is created.

    Another important thing to note here is, though SQL Server allows you to set [master] database as the default_database for new logins that you are creating, it doesn't mean they will be granted access to master database as a user. [master] database will just work as a landing database for them, nothing else.

    For more information on this you can check below link:

    Logins & Users in SQL Server


    Sujeet Singh