Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Operation method of MySQL batch killing process

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Below, I would like to give you a brief introduction to the operation of the MySQL batch killing process. Have you known about similar topics before? If you are interested, let's take a look at this article. I believe that after reading the operation method of the MySQL batch killing process, it will be more or less helpful to everyone.

First, through the SQL statement

Mysql > desc information_schema.processlist

+-+ +

| | Field | Type | Null | Key | Default | Extra | |

+-+ +

| | ID | bigint (21) unsigned | NO | | 0 | |

| | USER | varchar (32) | NO | |

| | HOST | varchar (64) | NO | |

| | DB | varchar (64) | YES | | NULL |

| | COMMAND | varchar (16) | NO | |

| | TIME | int (7) | NO | | 0 | |

| | STATE | varchar (64) | YES | | NULL |

| | INFO | longtext | YES | | NULL |

+-+ +

8 rows in set (0.00 sec)

Select concat ('KILL', id,';') from information_schema.processlist where state like'% User lock%'

Select concat ('KILL', id,';') from information_schema.processlist where state like'% User lock%' into outfile'/ tmp/a.txt'

Second, kill through mysqladimin

Mysqladmin-uroot-p processlist | grep-I lock | awk-F "|"'{print "kill" $2 ";"}'

Mysqladmin-uroot-p processlist | grep-I "lock" | awk-F "|"'{print $2}'| xargs mysqladmin-uroot-p kill

What do you think of the operation of the MySQL batch killing process? what do you think of this article and whether it has gained anything? If you want to know more about it, you can continue to follow our industry information section.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report