Fork me on GitHub
Suzf  Blog

How-to find MySQL process list and to kill those processes

License: Attribution-NonCommercial-ShareAlike 4.0 International

本文出自 Suzf Blog。 如未注明,均为 SUZF.NET 原创。

转载请注明:http://suzf.net/post/1437

有些时候由于MySQL 表和查询设计的不够好,常常以为一个SQL是这个数据库卡住亦或是查询变得灰常的慢。

那么我们该如何查到查询列表并杀死它们呢?

 

Here I go with solution.

  1. Login to DB.
  2. run command show full processlist;
  3. Here you will get the process id with status and Query it self which causing the problem of hanging database.
  4. Now select the process id and run command KILL <pid>;
  5. Now that point you kill that process.

Sometime that is not enough to kill each process manually. So, for that we've to go with some sort of trick. here I go with that trick:

  1. Login to MySql
  2. run that query Select concat('KILL ',id,';') from information_schema.processlist where user='user';
  3. This will print all the process with KILL command.
  4. Copy all the query result, manipulate them and remove pipe | sign and paste all again into the query console. HIT ENTER. BooM its done.

相关连接

[0] https://dev.mysql.com/doc/refman/5.7/en/kill.html

[1] https://stackoverflow.com/questions/44192418/how-to-find-mysql-process-list-and-to-kill-those-processes

[2] https://stackoverflow.com/questions/1903838/how-do-i-kill-all-the-processes-in-mysql-show-processlist

「一键投喂 软糖/蛋糕/布丁/牛奶/冰阔乐!」

Suzf Blog

(๑>ڡ<)☆ 谢谢 ~

使用微信扫描二维码完成支付