mysql_list_processes
Lists MySQL processes.
Function name: mysql_list_processes()
Function version: PHP 4, PHP 5, PHP 7
Function description: The mysql_list_processes() function is used to obtain the list of active processes on the current database server.
Syntax: resource mysql_list_processes ( [resource $link_identifier = NULL] )
parameter:
Return value: If successful, the function returns a result resource identifier to get the process list. If it fails, FALSE is returned.
Example:
// 连接到数据库服务器$link = mysql_connect("localhost", "username", "password"); // 检查连接是否成功if (!$link) { die("连接失败:" . mysql_error()); } // 获取进程列表$result = mysql_list_processes($link); // 检查获取结果是否成功if (!$result) { die("获取进程列表失败:" . mysql_error()); } // 打印进程列表while ($row = mysql_fetch_assoc($result)) { echo "ID: " . $row['Id'] . ", 用户: " . $row['User'] . ", 主机: " . $row['Host'] . ", 数据库: " . $row['db'] . "\n"; } // 释放结果资源mysql_free_result($result); // 关闭数据库连接mysql_close($link);
Notes: