title: How to stop a running mysql query
body: <p>How do I stop a running mysql query programmatically? </p>
  
  <p>The problem I'm facing is that a query is constructed using user supplied data, and may occasionally take a very long time to execute (large tables 15 - 30 million rows). I want to offer the user a cancel-option, but don't know how to stop the currently executing mysql-query.</p>
  
  <p>The application is a Java applet-servlet: the user specify criteria in the applet which is passed to the servlet where a handler-class is created to handle the request. This handler-class is self-contained re connect - query - disconnect to mysql. </p>
  
  <p>Given this scenario, how do I cancel a running mysql-query?</p>