content_image/743578.jpg content_image/743577.jpg content_image/743580.jpg content_image/743582.jpg content_image/743579.jpg content_image/743581.jpg
SET DEFAULT ROLE ’admin’, ’developer’ TO ’joe’@’10.0.0.1’; 

The host name part of the role name, if omitted, defaults to ’%’ . 

The clause following the DEFAULT ROLE  keywords permits these values: 

• NONE : Set the default to NONE  (no roles). 

• ALL : Set the default to all roles granted to the account. 

• role  [, role  ] ... : Set the default to the named roles, which must exist and be granted to the account at the time SET DEFAULT ROLE  is executed. 

## 13.7.1.10 SET PASSWORD Statement 

<img src='content_image/743578.jpg'>

For role usage examples, see Section 6.2.10, “Using Roles” . 

SET PASSWORD [FOR user ] auth_option [REPLACE ’ current_auth_string ’] [RETAIN CURRENT PASSWORD] auth_option : { = ’ auth_string ’ | TO RANDOM } 

<img src='content_image/743577.jpg'>

## Note 

SET DEFAULT ROLE  and SET ROLE DEFAULT  are different statements: 

• SET DEFAULT ROLE  defines which account roles to activate by default within account sessions. 

• SET ROLE DEFAULT  sets the active roles within the current session to the current account default roles. 

The SET PASSWORD  statement assigns a password to a MySQL user account. The password may be either explicitly specified in the statement or randomly generated by MySQL. The statement may also include a password-verification clause that specifies the account current password to be replaced, and a clause that manages whether an account has a secondary password. ’ auth_string ’  and ’ current_auth_string ’  each represent a cleartext (unencrypted) password. 

<img src='content_image/743580.jpg'>

<img src='content_image/743582.jpg'>

<img src='content_image/743579.jpg'>

## Note 

Rather than using SET PASSWORD  to assign passwords, ALTER USER  is the preferred statement for account alterations, including assigning passwords. For example: 

ALTER USER user  IDENTIFIED BY ’ auth_string ’; 

<img src='content_image/743581.jpg'>

## Note 

Clauses for random password generation, password verification, and secondary passwords apply only to accounts that use an authentication plugin that stores credentials internally to MySQL. For accounts that use a plugin that performs authentication against a credentials system that is external to MySQL, password management must be handled externally against that system as well. For more information about internal credentials storage, see Section 6.2.15, “Password Management” . 

