•For syntax that uses AS ’ auth_string ’ , the string is assumed to be already in the format the authentication plugin requires, and is stored as is in the mysql.user  table. If a plugin requires a hashed value, the value must be already hashed in a format appropriate for the plugin; otherwise, the value cannot be used by the plugin and correct authentication of client connections does not occur. 

As of MySQL 8.0.17, a hashed string can be either a string literal or a hexadecimal value. The latter corresponds to the type of value displayed by SHOW CREATE USER  for password hashes containing unprintable characters when the print_identified_with_as_hex  system variable is enabled. 

•If an authentication plugin performs no hashing of the authentication string, the BY ’ auth_string ’ and AS ’ auth_string ’  clauses have the same effect: The authentication string is stored as is in the mysql.user  system table. 

CREATE USER  permits these auth_option  syntaxes: 

• IDENTIFIED BY ’ auth_string ’ 

Sets the account authentication plugin to the default plugin, passes the cleartext ’ auth_string ’  value to the plugin for possible hashing, and stores the result in the account row in the mysql.user  system table. 

• IDENTIFIED BY RANDOM PASSWORD 

Sets the account authentication plugin to the default plugin, generates a random password, passes the cleartext password value to the plugin for possible hashing, and stores the result in the account row in the mysql.user  system table. The statement also returns the cleartext password in a result set to make it available to the user or application executing the statement. For details about the result set and characteristics of randomly generated passwords, see Random Password Generation. 

• IDENTIFIED WITH auth_plugin 

Sets the account authentication plugin to auth_plugin , clears the credentials to the empty string, and stores the result in the account row in the mysql.user  system table. 

• IDENTIFIED WITH auth_plugin  BY ’ auth_string ’ 

Sets the account authentication plugin to auth_plugin , passes the cleartext ’ auth_string ’  value to the plugin for possible hashing, and stores the result in the account row in the mysql.user  system table. 

• IDENTIFIED WITH auth_plugin  BY RANDOM PASSWORD 

Sets the account authentication plugin to auth_plugin , generates a random password, passes the cleartext password value to the plugin for possible hashing, and stores the result in the account row in the mysql.user  system table. The statement also returns the cleartext password in a result set to make it available to the user or application executing the statement. For details about the result set and characteristics of randomly generated passwords, see Random Password Generation. 

• IDENTIFIED WITH auth_plugin  AS ’ auth_string ’ 

Sets the account authentication plugin to auth_plugin  and stores the ’ auth_string ’  value as is in the mysql.user  account row. If the plugin requires a hashed string, the string is assumed to be already hashed in the format the plugin requires. 

Example: Specify the password as cleartext; the default plugin is used: 

CREATE USER ’jeffrey’@’localhost’ 

