Terminate MySQL Connections

May 21, 2009
Author
Peter Zaitsev
Share this Post:

Every so often I run into a situation when I need to terminate connections on MySQL server – for example, hundreds of instances of some bad query is running, making the server unusable. Many people have special scripts which can take the user, source host, or query as a parameter and perform the action. There is also a way to do it just using MySQL with a few commands:

In general, this is a very powerful approach which I use in a lot of cases to create a set of SQL statements by SQL query and then execute it.

It would be nice and clean if MySQL would have some way to “eval” – execute the result set of the query as SQL commands. This would avoid the requirement to use temporary file etc.

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Far
Enough.

Said no pioneer ever.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.
© 2026 Percona All Rights Reserved