CREATE USER statement

Description

Creates a user.

Syntax

CREATE USER  user-name  [ IDENTIFIED BY password ]
[ LOGIN POLICY policy-name ]
[ FORCE PASSWORD CHANGE { ON | OFF } ]

Examples

Example 1

The following example creates a user named SQLTester with the password welcome. The SQLTester user is assigned to the Test1 login policy and the password expires on the next login.

CREATE USER SQLTester IDENTIFIED BY welcome
LOGIN POLICY Test1
FORCE PASSWORD CHANGE ON;

Example 2

The following example creates a group named MyGroup

CREATE USER MyGroup;
GRANT GROUP TO MyGroup;

Usage

user-name The name of the user.

IDENTIFIED BY clause Clause providing the password for the user.

policy-name The name of the login policy to assign the user. No change is made if the LOGIN POLICY clause is not specified.

FORCE PASSWORD CHANGE clause Controls whether the user must specify a new password when they log in. This setting overrides the password_expiry_on_next_login option setting in their policy.

You do not have to specify a password for the user. A user without a password cannot connect to the database. This is useful if you are creating a group and do not want anyone to connect to the database using the group user ID. A user ID must be a valid identifier.

User IDs and passwords cannot:

A password can be either a valid identifier, or a string (maximum 255 bytes) placed in single quotes. Passwords are case sensitive. It is recommended that the password be composed of 7-bit ASCII characters, as other characters may not work correctly if the database server cannot convert them from the client's character set to UTF-8.

The VERIFY_PASSWORD_FUNCTION option can be used to specify a function to implement password rules (for example, passwords must include at least one digit). If a password verification function is used, you cannot specify more than one user ID and password in the GRANT CONNECT statement. For details, see “VERIFY_PASSWORD_FUNCTION option” and “GRANT statement”.

Side Effects None.

Standards

Permissions

Must be owner of the view or have DBA authority.

See also

“ALTER LOGIN POLICY statement”

“CREATE USER statement”

“COMMENT statement”

“CREATE LOGIN POLICY statement”

“DROP LOGIN POLICY statement”

“DROP USER statement”

“GRANT statement”.

“Managing login policies overview” in SQL Anywhere Server – Database Administration > Configuring Your Database > Managing user IDs, authorities, and permissions