mysql.rds_kill_query_id
终止针对MySQL或MariaDB服务器运行的查询。
语法
CALL mysql.rds_kill_query_id(queryID);
参数
queryID
整数。将终止的查询的标识。
使用说明
要终止针对 MariaDB 服务器运行的查询,请使用 mysql.rds_kill_query_id 过程并传入该查询的 ID。要获
取查询 ID,如下所示:
SELECT USER, HOST, COMMAND, TIME, STATE, INFO, QUERY_ID FROM
INFORMATION_SCHEMA.PROCESSLIST WHERE USER = '<user name>
以下示例终止查询 ID 为 11195102 的查询:
call mysql.rds_kill_query_id(11195102);
批量kill session的语句:
select concat('CALL mysql.rds_kill(',id,');') from information_schema.processlist where user='gwmmm';
select concat('CALL mysql.rds_kill(',trx_mysql_thread_id,');') from information_schema.innodb_trx;
CALL mysql.rds_kill( 11195230);
CALL mysql.rds_kill( 11195102);
CALL mysql.rds_kill( 11195114);
CALL mysql.rds_kill( 11195108);
CALL mysql.rds_kill( 11195179);
CALL mysql.rds_kill( 11195224);
CALL mysql.rds_kill( 11195214);
CALL mysql.rds_kill( 11194577);
CALL mysql.rds_kill( 11195476);
CALL mysql.rds_kill( 11194995);
CALL mysql.rds_kill( 11195187);
CALL mysql.rds_kill( 11195022);
CALL mysql.rds_kill( 11195319);