Grants CONNECT privilege to a user.
GRANT CONNECT TO userID [,...] IDENTIFIED BY password [,...]
GRANT CONNECT TO Laurel, Hardy IDENTIFIED BY Stan, Ollie
GRANT CONNECT TO Jane
GRANT CONNECT TO Bob IDENTIFIED BY newpassword
GRANT CONNECT can be used to create a new user or also be used by any user to change their own password.
If you inadvertently enter the user ID of an existing user when you are trying to add a new user, you are actually changing the password of the existing user. You do not receive a warning because this behavior is considered normal.
The stored procedures sp_addlogin and sp_adduser can also be used to add users. These procedures display an error if you try to add an existing user ID.
A user without a password cannot connect to the database. This is useful when you are creating groups and you do not want anyone to connect to the role user ID. To create a user without a password, do not include the IDENTIFIED BY clause.
When specifying a password, it must be a valid identifier Passwords have a maximum length of 255 bytes. If the VERIFY_PASSWORD_FUNCTION database option is set to a value other than the empty string, the GRANT CONNECT TO statement calls the function identified by the option value. The function returns NULL to indicate that the password conforms to rules. If the VERIFY_PASSWORD_FUNCTION option is set, you can specify only one userid and password with the GRANT CONNECT statement.
Invalid names for database user IDs and passwords include those that: