mysql_stat
Get the current system status.
Function name: mysql_stat()
Applicable version: PHP 4, PHP 5, PHP 7
Function description: the mysql_stat() function returns the status information of the current MySQL server.
usage:
string mysql_stat ([ resource $link_identifier = NULL ] )
parameter:
mysql_connect()
.Return Value: Returns a string describing the status of the MySQL server. The format of the string is "Uptime: %d Threads: %d Questions: %d Slow queries: %d Opens: %d Flush tables: %d Open tables: %d Queries per second avg: %f".
Example:
$link = mysql_connect('localhost', 'username', 'password'); if (!$link) { die('Could not connect: ' . mysql_error()); } $stat = mysql_stat($link); echo "MySQL Server Status: " . $stat; mysql_close($link);
Output example:
MySQL Server Status: Uptime: 12345 Threads: 5 Questions: 10000 Slow queries: 2 Opens: 50 Flush tables: 1 Open tables: 10 Queries per second avg: 5.678
Notes:
mysql_stat()
function can only be used for MySQL extensions (mysql), and not for MySQLi extensions (mysqli) or PDO extensions.mysql_
function, but to use MySQLi or PDO to connect and operate the MySQL database.