Text protocol commands are sent from client to server. The text protocol has a less comprehensive format than the binary protocol, which is used by prepared statements only
COM_CHANGE_USER resets the connection and re-authenticates with the given credentials. The packet is identical to the authentication packet in the connection handshake.
int<1> 0x11 : COM_CHANGE_USER header
string username
if (server_capabilities & CLIENT_SECURE_CONNECTION)
int<1> length of authentication response
string authentication response
else
string authentication response
string default schema name
int<2> client character collation
if (server_capabilities & CLIENT_PLUGIN_AUTH)
string authentication plugin name
Server response is like connection authentication :
An OK packet in case of success OK_Packet.
An error packet in case of error ERR_Packet.
Authentication switch
If the client or server doesn't have PLUGIN_AUTH capability:
Server sends 0xFE byte .
Client sends old_password.
else
Server sends Authentication switch request.
Client may have many exchanges with the server according to the Plugin.
Authentication switch ends with server sending either OK_Packet or ERR_Packet.
This page is licensed: CC BY-SA / Gnu FDL
Warning: This command is deprecated and not used by MariaDB connectors any more. Please use the SQL statements CREATE SCHEMA or CREATE DATABASE instead.
This page is licensed: CC BY-SA / Gnu FDL
The COM_DEBUG command forces the server to dump debug information to stdout. It requires super privileges.
int<1> 0xOD : COM_DEBUG Header
This page is licensed: CC BY-SA / Gnu FDL
Warning: This command is deprecated and not used by MariaDB connectors any more. Please use the SQL statements DROP SCHEMA or DROP DATABASE instead.
This page is licensed: CC BY-SA / Gnu FDL
Warning: This command is deprecated and not used by MariaDB connectors any more. Please use the SQL statements SHOW COLUMNS or SELECT FROM INFORMATION_SCHEMA.COLUMNS instead.
int<1> 0x04 : COM_FIELD_LIST Header
This page is licensed: CC BY-SA / Gnu FDL
COM_INIT_DB is used to specify the default schema for the connection.
06 00 00 00 02 74 65 73 74 63 .....testc
This page is licensed: CC BY-SA / Gnu FDL
Forces the server to terminate a specified connection.
This page is licensed: CC BY-SA / Gnu FDL
Warning: This command is deprecated and not used by MariaDB connectors any more. Please use the SQL statement SHOW PROCESSLIST instead.
This page is licensed: CC BY-SA / Gnu FDL
With the COM_QUERY command, the client sends the server an SQL statement to be executed immediately.
The SQL statement should be properly escaped. The escape character is usually a backslash '' = 0x5c. However, if the status flag returned by the last OK Packet had NO_BACKSLASH_ESCAPES bit set then the escape character is a single quote(' = 0x60)
If the escape character is a backslash, the following characters are escaped:
single quote (' = 0x60)
back slash (\ = 0x5c)
double quote (" = 0x22)
null character (0x00)
If the escape character is a single quote, only the single quote (' = 0x60) can be escaped.
The server can answer with 4 different responses that can be differentiated by the first byte (packet header):
0xFF - ERR_Packet if any error occurs.
0x00 - OK_Packet when query execution works without resultset.
0xFB - LOCAL_INFILE Packet if the query was "LOCAL INFILE ...".
Or a Resultset, when the query returns results (in case of a SELECT query for example).
1b 00 00 00 03 44 52 4f 50 20 54 41 42 4c 45 20
.....DROP TABLE
49 46 20 45 58 49 53 54 53 20 62 75 6c 6b 31
IF EXISTS bulk1
This page is licensed: CC BY-SA / Gnu FDL
Using the COM_QUIT command, the client tells the server that the connection should be terminated.
int<1> 0x01 : COM_QUIT Header
Server terminates connection.
This page is licensed: CC BY-SA / Gnu FDL
COM_RESET_CONNECTION Resets a connection without re-authentication.
This will :
rollback any open transaction
reset transaction isolation level
reset session variables
delete user variables
remove temporary tables
remove all PREPARE statement
Database will NOT be reset to initial value.
int<1> 0x1f : COM_RESET_CONNECTION Header
This page is licensed: CC BY-SA / Gnu FDL
Enables or disables server option.
Options
Constant
Value
MYSQL_OPTION_MULTI_STATEMENTS_ON
0
MYSQL_OPTION_MULTI_STATEMENTS_OFF
1
EOF Packet on success or ERR packet.
This page is licensed: CC BY-SA / Gnu FDL
Shuts down the server. To execute this command the SHUTDOWN privilege is required.
Options
Constant
Value
SHUTDOWN_DEFAULT
0
OK Packet or ERR packet.
This page is licensed: CC BY-SA / Gnu FDL
This command is used inside the server only.
used inside server only
int<1> 0x00 : COM_SLEEP header
This page is licensed: CC BY-SA / Gnu FDL