MySQL 8.4.2
Source Code Documentation
|
Depending on the servers support for the CLIENT_PROTOCOL_41 capability and the clients understanding of that flag the client has to send either a Protocol::HandshakeResponse320 or Protocol::HandshakeResponse41.
Old Handshake Response Packet used by old clients or if the server doesn't support CLIENT_PROTOCOL_41 Capabilities Flags flag.
Type | Name | Description |
---|---|---|
int<2> | client_flag | Capabilities Flags, only the lower 16 bits. CLIENT_PROTOCOL_41 should never be set |
int<3> | max_packet_size | maximum packet size, 0xFFFFFF max |
string<NUL> | username | login user name |
if capabilities & CLIENT_CONNECT_WITH_DB { | ||
string<NUL> | auth-response | Opaque authentication response data generated by Authentication Method indicated by the plugin name field. |
string<NUL> | database | initial database for the connection. This string should be interpreted using the character set indicated by character set field. |
} else { | ||
string<EOF> | auth-response | Opaque authentication response data generated by Authentication Method indicated by the plugin name field. |
} |
Handshake Response Packet sent by 4.1+ clients supporting CLIENT_PROTOCOL_41 Capabilities Flags flag, if the server announced it in its Protocol::Handshake. Otherwise (talking to an old server) the Protocol::HandshakeResponse320 packet must be used.
Type | Name | Description |
---|---|---|
int<4> | client_flag | Capabilities Flags, CLIENT_PROTOCOL_41 always set. |
int<4> | max_packet_size | maximum packet size |
int<1> | character_set | client charset a_protocol_character_set, only the lower 8-bits |
string[23] | filler | filler to the size of the handhshake response packet. All 0s. |
string<NUL> | username | login user name |
if capabilities & CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA { | ||
string<length> | auth_response | opaque authentication response data generated by Authentication Method indicated by the plugin name field. |
} else { | ||
int<1> | auth_response_length | length of auth_response |
string<length> | auth_response | opaque authentication response data generated by Authentication Method indicated by the plugin name field. |
} | ||
if capabilities & CLIENT_CONNECT_WITH_DB { | ||
string<NUL> | database | initial database for the connection. This string should be interpreted using the character set indicated by character set field. |
} | ||
if capabilities & CLIENT_PLUGIN_AUTH { | ||
string<NUL> | client_plugin_name | the Authentication Method used by the client to generate auth-response value in this packet. This is an UTF-8 string. |
} | ||
if capabilities & CLIENT_CONNECT_ATTRS { | ||
int<lenenc> | length of all key-values | affected rows |
string<lenenc> | key1 | Name of the 1st client attribute |
string<lenenc> | value1 | Value of the 1st client attribute |
.. (if more data in length of all key-values, more keys and values parts) | ||
} | ||
if capabilities & CLIENT_ZSTD_COMPRESSION_ALGORITHM { | ||
int<1> | zstd_compression_level | compression level for zstd compression algorithm |
} |
On MySQL 5.5.8 with CLIENT_PROTOCOL_41 CLIENT_PLUGIN_AUTH, CLIENT_SECURE_CONNECTION (removed in 8.0), and CLIENT_CONNECT_WITH_DB set, it may look like:
Starting with MySQL 5.6.6 the client may send attributes if CLIENT_CONNECT_ATTRS is set: