Buscar este blog

viernes, 20 de abril de 2012

How to stop a running mysql query

login in mysql

[root@sol ~]#mysql -u username -p

SHOW PROCESSLIST;
KILL <thread_to_be_killed>;


Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>  SHOW PROCESSLIST;
+----+--------+---------------------+--------+---------+------+-----------+------------------------------------------------------------------------------------------------------+
| Id | User   | Host                | db     | Command | Time | State     | Info                                                                                                 |
+----+--------+---------------------+--------+---------+------+-----------+------------------------------------------------------------------------------------------------------+
|  2 | bacula | 192.168.2.229:55920 | NULL   | Sleep   |   50 |           | NULL                                                                                                 |
|  3 | bacula | localhost           | bacula | Query   |  463 | executing | SELECT Path.Path, Filename.Name, Temp.FileIndex, Temp.JobId, LStat, MD5 FROM ( SELECT FileId, Job.Jo |
|  4 | root   | localhost           | NULL   | Query   |    0 | NULL      | SHOW PROCESSLIST                                                                                     |
+----+--------+---------------------+--------+---------+------+-----------+------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)

mysql>
kill 3;


No hay comentarios:

Publicar un comentario