

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I stop a running MySQL query?
In order to stop a running MySQL query, we can use the KILL command with process id. The syntax is as follows −
kill processId;
Or you can stop a running MySQL query with the help of below syntax −
call mysql.rds_kill(queryId);
Let us first get the processId with the help of show command. The query is as follows −
mysql> show processlist;
Here is the output with the list of processes −
+----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+ | 4 | event_scheduler | localhost | NULL | Daemon | 221718 | Waiting on empty queue | NULL | | 47 | root | localhost:60722 | business | Query | 0 | starting | show processlist | +----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+ 2 rows in set (0.03 sec)
Here, two processes are running in MySQL and if you want to stop one of them, then you can use above syntax with the specific id using “KILL”
The query is as follows −
mysql> kill 47; ERROR 1317 (70100): Query execution was interrupted
Alternatively, you can do this with mysql.rds_kill(id). The query is as follows −
mysql> CALL mysql.rds_kill(47); ERROR 2013 (HY000): Lost connection to MySQL server during query
- Related Questions & Answers
- How can I stop running a MySQL query?
- How can I display MySQL query result vertically?
- How can I stop a video with JavaScript in Youtube?
- How can I enable MySQL slow query log without restarting MySQL?
- How can I profile C++ code running in Linux?
- How can I profile C++ code running on Linux?
- How can I avoid too many OR statements in a MySQL query?
- How do I stop a MySQL decimal field from being rounded?
- How can I get maximum and minimum values in a single MySQL query?
- How can I set 0 if a query returns a null value in MySQL?
- Can I get Age using BirthDate column in a MySQL query?
- How I can show progress of long running PYTHON CGI script?
- How can I get the output of multiple MySQL tables from a single query?
- How can I add one day to DATETIME field in MySQL query?
- How can I make Matplotlib.pyplot stop forcing the style of my markers?
Advertisements