3.3 How Can I Run a Process Every Night To Kill Certain Connections?

3.3.1 Objectives
3.3.2 Example Execution
3.3.3 Discussion
3.3.4 Permissions Required
3.3.5 Tips and Tricks

Some database administrators use nightly routines to perform maintenance on their databases or servers. Sometimes these routines can be blocked by long running queries or applications that hang onto locks for longer than expected.

Naturally, priority is given to the application and maintenance routines are often cancelled rather than interfere with an application. Should it happen that you subscribe to this notion and you have a routine that is still being blocked or for some reason hasn't completed by a certain time, you need a quick way to generate an event to kill the connection involved. This is where the mysqlprocgrep utility can help.