Documentation Home
MySQL Internals Manual

MySQL Internals Manual  /  ...  /  Authentication After COM_CHANGE_USER Command

14.2.4 Authentication After COM_CHANGE_USER Command

During Command Phase, a client can send a COM_CHANGE_USER command which will trigger logging into a new account, including the authentication handshake.

Similar to the initial authentication the server may reply with a OK_Packet or ERR_Packet for the usual fast-path or with a Authentication Method Switch Request Packet which contains the authentication method used for the new account and the first authentication data payload to be consumed by the client. Further handshake continues as usual, as defined by the authentication method being used. Eventually server will accept new account with OK_Packet and resume the command phase or it will reject change with ERR_Packet and disconnect.

  1. the client sends COM_CHANGE_USER packet

  2. the server responds with the Authentication Method Switch Request Packet which initiates authentication handshake using the correct authentication method

  3. client and server exchange further packets as required by the authentication method used

  4. the server responds with OK_Packet and returns to command phase or ERR_Packet and closes the connection