I connect to mysql
from my Linux shell. Every now and then I run a SELECT
query that is too big. It prints and prints and I already know this is not what I meant. I would like to stop the query.
Hitting Ctrl+C
(a couple of times) kills mysql
completely and takes me back to shell, so I have to reconnect.
Is it possible to stop a query without killing mysql
itself?
mysql> show processlist;
+----+------+-----------+-----+---------+------+---------------------+------------------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+----+------+-----------+-----+---------+------+---------------------+------------------------------+----------+
| 14 | usr1 | localhost | db1 | Query | 0 | starting | show processlist | 0.000 |
| 16 | usr1 | localhost | db1 | Query | 94 | Creating sort index | SELECT `tbl1`.* FROM `tbl1` | 0.000 |
+----+------+-----------+-----+---------+------+---------------------+------------------------------+----------+
2 rows in set (0.000 sec)
mysql> kill 16;
Query OK, 0 rows affected (0.004 sec)
mysql> show processlist;
+----+------+-----------+-----+---------+------+----------+------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+----+------+-----------+-----+---------+------+----------+------------------+----------+
| 14 | usr1 | localhost | db1 | Query | 0 | starting | show processlist | 0.000 |
+----+------+-----------+-----+---------+------+----------+------------------+----------+
1 row in set (0.000 sec)