php8.5
Home/ Manual/ mysql / functions/ mysql_list_processes

mysql_list_processes

PHP function Edit on GitHub ✎

(PHP 4 >= 4.3.0, PHP 5)

List MySQL processes

Note mysqli_thread_id

Description

mysql_list_processes(resource $link_identifier = NULL): resource|false

Retrieves the current MySQL server threads.

Parameters

Return Values

A result pointer resource on successFalseforfailure.

Examples

mysql_list_processes() example

php
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');

$result = mysql_list_processes($link);
while ($row = mysql_fetch_assoc($result)){
    printf("%s %s %s %s %s\n", $row["Id"], $row["Host"], $row["db"],
        $row["Command"], $row["Time"]);
}
mysql_free_result($result);
?>

The above example will output something similar to:

output
1 localhost test Processlist 0
4 localhost mysql sleep 5

See Also

Source: reference/mysql/functions/mysql-list-processes.xml · from the official PHP manual (php/doc-en)