The author of this question mentions that it’s usually only after
MySQL prints its output that he realises that the wrong query was executed.
As noted, in this case, Ctrl-C
doesn’t help. However, I’ve noticed that it
will abort the current query – if you catch it before any output is
printed. For example:
mysql> select * from jos_users, jos_comprofiler;
MySQL gets busy generating the Cartesian Product of the above two tables and
you soon notice that MySQL hasn't printed any output to screen (the process
state is Sending data) so you type Ctrl-C
:
Ctrl-C -- sending "KILL QUERY 113240" to server ...
Ctrl-C -- query aborted.
ERROR 1317 (70100): Query execution was interrupted
Ctrl-C
can similarly be used to stop an UPDATE
query.