Brothersoft.comWindows|Mac|Mobile|Games

|Message

Solve software problem quickly Share experience to help others Improve the ability of solving problem
How to Kill Long-Running Queries in MySQL?

10/31/2011 04:01 by KCornell

First answer posted by SteveQueen at 10/31/2011 04:01
Add Your Answer
10~1000 characters in length CAPTCHA:
2 Answers
  • SteveQueen
    1. Click the Windows "Start" button and type "cmd" in the search text box. Press "Enter" to open the Windows command line.

    2. Type "mysql -h localhost -u user -pass" where "localhost" is the name of the MySQL server, "user" is your database username and "pass" is the user password to access the server. The username you use must have root access to the server to stop processes.

    3. Type "show full processlist" and press "Enter." The command shows each query running on the server and the amount of time the query has been running. Take note of the process ID associated with the long-running query.

    4. Type "kill process_ID" and press "Enter" where "process_ID" is the ID for the query you retrieved in Step 3. The query stops immediately and releases the server's resources.

  • Was this answer helpful? 00 · 10/31/2011 04:01
  • Anonymous user
  • mysql -e 'show processlist\G'\egrep -b5 'Time: [6-9][0-9][0-9]'\grep -v 'repluser'\grep 'Id:'\cut -d':' -f2\grep -v '155'\sed 's/^ //'\while read iddo    mysql -e "kill $id;"done
  • Was this answer helpful? 00 · 11/29/2011 04:27
Add Your Answer
10~1000 characters in length CAPTCHA:
Related Questions
Q:What's Tutorial on Stored Procedures in MySQL 3.23?

A: Create your stored procedure code block and assign it a name. The first part of your stored procedure creation command is the "create proc...(more)

Q:How to Use Subquery in a Clause in T-SQL?

A: Click "Start," "All Programs" and "SQL Server 2008." Select "SQL Server Management Studio." Log into SQL Server using your username and pa...(more)

Q:How to Use Select in Insert Statement?

A: Clarify the Insert statement syntax and semantics for the SQL version you're using. Not all SQL versions support the Select statement as p...(more)

Q:MySQL Create a Database Tutorial

A:When you first start the MySQL server, you must create a blank database and fill it with tables. Before setting up the database and the tabl...(more)

Q:The Disadvantages of Indexes on Computed Columns

A:Using indexes on computed columns in database tables has certain advantages in processing speed, it also comes with some structural disadvan...(more)

Added Successfully!

×

Are you sure to delete your answer?

NoYes

×

Are you sure to choose it as the best answer?

NoYes

×

Voted Successfully!

×

You can't vote for yourself

×

You can't choose your own answer

×