Documentation Home
MySQL Internals Manual


MySQL Internals Manual  /  ...  /  COM_CHANGE_USER

14.6.18 COM_CHANGE_USER

COM_CHANGE_USER changes the user of the current connection and reset the connection state.

  • user variables

  • temp tables

  • prepared statemants

  • ... and others

It is followed by the same states as the initial handshake.

COM_CHANGE_USER:

change the user of the current connection

Returns

Authentication Method Switch Request Packet or ERR_Packet

Payload
1              [11] COM_CHANGE_USER
string[NUL]    user
  if capabilities & SECURE_CONNECTION {
1              auth-response-len
string[$len]   auth-response
  } else {
string[NUL]    auth-response
  }
string[NUL]    schema-name
  if more data {
2              character-set
    if capabilities & CLIENT_PLUGIN_AUTH {
string[NUL]    auth plugin name
    }
    if capabilities & CLIENT_CONNECT_ATTRS) {
lenenc-int     length of all key-values
lenenc-str     key
lenenc-str     value
   if-more data in 'length of all key-values', more keys and value pairs
    }
  }
Fields
  • command (1) -- command byte

  • username (string.NUL) -- user name

  • auth_plugin_data_len (1) -- length of the auth_plugin_data filed

  • auth_plugin_data (string.var_len) -- auth data

  • schema (string.NUL) -- default schema

  • character_set (2) -- new connection character set (see Protocol::CharacterSet)

  • auth_plugin_name (string.NUL) -- name of the auth plugin that auth_plugin_data corresponds to

  • connect_attrs_len (lenenc_int) -- length in bytes of the following block of key-value pairs

Implemented By

parse_com_change_user_packet()

character set is the connection character set as defined in Protocol::CharacterSet and is also the encoding of user and schema-name.


User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.