Documentation Home
MySQL Internals Manual
Download this Manual
EPUB - 0.8Mb

MySQL Internals Manual  /  ...  /  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.


change the user of the current connection


Authentication Method Switch Request Packet or ERR_Packet

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
  • 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


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

Download this Manual
EPUB - 0.8Mb
User Comments
Sign Up Login You must be logged in to post a comment.