Mysql_stat () queries the current system status of the MySQL server

Source: Internet
Author: User
Tags mysql tutorial

Mysql Tutorial: mysql_stat () query the current system status of the MySQL server

Definition and usage

The mysql_stat () function returns the current system status of the MySQL server.

If yes, the function returns the status. If it fails, false is returned.

Syntax

Description of the mysql_stat (connection) parameter

Connection is optional. MySQL connection is required. If not specified, the previous connection is used.

Tips and comments

Note: currently, mysql_stat () Only returns uptime, threads, queries, open tables, flush tables, and queries per second. To obtain a complete list of other state variables, you can only use the SQL command SHOW STATUS.

Example

$ Con= mysql_connect ("localhost", "hello", "321 ");

If (! $ Con)

{

Die ('could not connect: '. mysql_error ());

}

$ Db_selected = mysql_select_db ("test_db", $ con );

Echo mysql_stat ();

?>

The output is similar:

Uptime: 99410 Threads: 1 Questions: 162

Slow queries: 0 Opens: 0 Flush tables: 1

Open tables: 0 Queries per second avg: 0.002

Note: For more exciting articles, please follow the help houseProgramming TutorialTopic.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.