Created
January 22, 2016 13:37
-
-
Save Bat-Chat/b5386434374bc0581993 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// show all processes (queries) | |
$result = mysql_query("show full processlist"); | |
while($row = mysql_fetch_array($result, MYSQL_NUM)) { | |
print_r($row); | |
} | |
// stop process (query) by id | |
mysql_query("kill 1724864106"); | |
// stop all processes (queries) | |
$result = mysql_query("show full processlist"); | |
while($row = mysql_fetch_array($result)) { | |
$processId = $row["Id"]; | |
if($row["Time"] > 200 ) { | |
$sql = "KILL $processId"; | |
mysql_query($sql); | |
} | |
} | |
// make query in 10 secs | |
mysql_query("SELECT SLEEP (10)"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment