Creates a login for the MDB instance. For examples, see Examples.
CREATE LOGIN login_name WITH PASSWORD = "password" [DEFAULT = database_name];
Specifies the name of the login to be created.
Specifies the password for the login that is being created.
DEFAULT = database_name
Specifies the default database to be assigned to the login. If this option is not included, the default database is set to master.
MANAGEMENT permissions required on the master database.
MANAGEMENT permissions default to members of the admin fixed database role. Members of the admin fixed database role can transfer permissions to logins and users.
MDB logins are stored in the master database and should be backed up whenever a login is created.
CREATE LOGINcommand must be run in autocommit mode and can't be rolled back.
Upon logging into the system, if a
DEFAULTdatabase has been specified, the system will attempt to connect to that database. If there exists a database user that is mapped to the login, the login inherits the user's permissions and encryption keys and will successfully connect to the default database. If no user is found, an error is produced.
MDB implements the
CREATE LOGIN statement by using the following steps:
- MDB stores the salted password information in the master database.
- A unique ID is assigned to the login.
- The login principal is used to run commands on the master database.
Creating a login.
The following example creates a new login.
CREATE LOGIN <login_name> WITH PASSWORD = "<enterStrongPasswordHere>";