https://github.com/sea-boat/mysql-protocol
# mysql客戶端可以用process kill指令讓服務端終止某個連接,正常會回傳ok包。
類型 | 名字 | 描述 |
---|---|---|
#int<3> | payload長度 | #按照the least significant byte first存儲,3個字節的payload和1個字節的序號組合成報文頭 |
int<1> | #序號 | |
payload | 報文體,長度即為前面指定的payload長度 |
Payload
1 [0c] COM_PROCCESS_KILL4 connection id
/** * * <pre class="brush:php;toolbar:false"><b>mysql process kill packet.</b>* @author *
seaboat*
<b>email: </b>849586227@qq.com*
<b>blog: </b>//m.sbmmt.com/;/pre> * @version 1.0 * @see //m.sbmmt.com/ */public class ProcessKillPacket extends MySQLPacket { public byte flag = (byte) 0xfe; public int connectionId; @Override public void read(byte[] data) { MySQLMessage mm = new MySQLMessage(data); packetLength = mm.readUB3(); packetId = mm.read(); flag = mm.read(); connectionId = mm.readInt(); } @Override public void write(ByteBuffer buffer) { int size = calcPacketSize(); BufferUtil.writeUB3(buffer, size); buffer.put(packetId); buffer.put(COM_PROCESS_KILL); BufferUtil.writeInt(buffer, connectionId); } @Override public int calcPacketSize() { return 5; } @Override protected String getPacketInfo() { return "MySQL Process Kill Packet"; } }
#