kill processid;
或者您可以借助以下语法停止正在运行的 mysql 查询 -
call mysql.rds_kill(queryid);
让我们首先借助 show 命令获取 processid。查询如下 -
mysql> show processlist;
这是带有进程列表的输出 -
+----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+| id | user | host | db | command | time | state | info |+----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+| 4 | event_scheduler | localhost | null | daemon | 221718 | waiting on empty queue | null || 47 | root | localhost:60722 | business | query | 0 | starting | show processlist |+----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+2 rows in set (0.03 sec)
这里,mysql 中正在运行两个进程,如果你想停止其中一个进程,那么你可以使用上面的语法和特定的 id 使用“kill”
查询如下 -mysql> kill 47;error 1317 (70100): query execution was interrupted
或者,您可以使用 mysql.rds_kill(id) 来执行此操作。查询如下 -
mysql> call mysql.rds_kill(47);error 2013 (hy000): lost connection to mysql server during query
以上就是如何停止正在运行的 mysql 查询?的详细内容。
