MySQL a script to check the running status

Source: Internet
Author: User

Linux using Mysqladmin extended-status with Linux commands to view MySQL running status

mysqladmin -uroot -ppassword -s /tmp/mysql_3306.sock -r -i 1 -c  10 ext |awk -f "|"   "BEGIN{ COUNT=0; }" ' { if ($2 ~ /variable_name/ && ++count  == 1) {    print  "----------|---------|----TRANSACTIONS----|--- mysql  command status --|----- Innodb row operation ----|-- buffer pool  read --";    print "---time---|---QPS---|commit rollback ~tps| select insert update delete|  read inserted updated deleted|    logical    physical ";} else if  ($2 ~ /queries/) {queries=$3;} else if  ($2 ~ /com_commit /) {com_commit=$3;} else if  ($2 ~ /com_rollback /) {com_rollback=$3;} else if  ($2 ~ /com_select /) {com_select=$3;}else if  ($2 ~ /com_insert /) {com_insert=$3;} else if  ($2 ~ /com_update /) {com_update=$3;} else if  ($2 ~ /com_delete /) {com_delete=$3;} else if  ($2 ~ /innodb_rows_read/) {innodb_rows_read=$3;} else if  ($2 ~ /innodb_rows_deleted/) {innodb_rows_deleted=$3;} else if  ($2 ~ /innodb_rows_inserted/) {innodb_rows_inserted=$3;} else if  ($2 ~ /innodb_rows_updated/) {innodb_rows_updated=$3;} else if  ($2 ~ /innodb_buffer_pool_read_requests/) {innodb_lor=$3;} else if  ($2 ~ /innodb_buffer_pool_reads/) {innodb_phr=$3;} else if  ($2 ~ /uptime / && count >= 2) {   printf (" %s |%9d", Strftime ("%h:%m:%s"), queries);   printf ("|%6d %6d %6d", com_ Commit,com_rollback,com_commit+com_rollback);   printf ("|%6d %6d %6d %6d", com_select,com_insert,com_update,com_delete);   printf ("|%6d %8d %7d %7d", innodb_rows _read,innodb_rows_inserted,innodb_rows_updated,innodb_rows_deleted);   printf ("|%10d %11d\n", INNODB_LOR,INNODB_PHR);}} '

According to Http://www.jb51.net/article/53900.htm finishing


The second edition reads as follows:

mysqladmin -uroot -psunyankui -s /tmp/mysql_3306.sock -r -i 1 -c  10 ext |awk -f "|"   "BEGIN{ COUNT=0; }" ' { if ($2 ~ /variable_name/ && ++count  == 1) {    print  "----------|---------|----TRANSACTIONS----|--- mysql  command status --|----- Innodb row operation ----|-- buffer pool  read --|-----Threads-----";    print "---time---|---QPS---|commit  rollback ~tps|select insert update delete|  read inserted updated  deleted|   logical    physical|connected running ";} else if  ($2 ~ /queries/) {queries=$3;} else if  ($2 ~ /com_commit /) {com_commit=$3;} else if  ($2 ~ /com_rollback /) {com_rollback=$3;} else if  ($2  ~ /com_select /) {com_select=$3;} else if  ($2 ~ /com_insert /) {com_insert=$3;} else if  ($2 ~ /com_update /) {com_update=$3;} else if  ($2 ~ /com_delete /) {com_delete=$3;} else if  ($2 ~ /innodb_rows_read/) {innodb_rows_read=$3;} else if  ($2 ~ /innodb_rows_deleted/) {innodb_rows_deleted=$3;} else if  ($2 ~ /innodb_rows_inserted/) {innodb_rows_inserted=$3;} else if  ($2 ~ /innodb_rows_updated/) {innodb_rows_updated=$3;} else if  ($2 ~ /threads_connected /) {threads_connected=$3;} else if  ($2 ~ /threads_running /) {threads_running=$3;} else if  ($2 ~ /innodb_buffer_pool_read_requests/) {innodb_lor=$3;} else if  ($2 ~ /innodb_buffer_pool_reads/) {innodb_phr=$3;} else if  ($2 ~ /uptime / && count >= 2) {  p rintf (" %s |%9d", Strftime ("%h:%m:%s"), queries),   printf ("|%6d %6d %6d", Com_ Commit,com_rollback,com_commit+com_rollback);   printf ("|%6d %6d %6d %6d", Com_select, Com_insert,com_update,com_delete);   printf ("|%6d %8d %7d %7d", Innodb_rows_read,innodb _rows_inserted,innodb_rows_updated,innodb_rows_deleted);   printf ("|%10d %11d", Innodb_lor,innodb _PHR);   printf ("|%9d %7d\n", threads_connected,threads_running);} '


This article is from the "just out of the shell of the Birds" blog, please be sure to keep this source http://qhd2004.blog.51cto.com/629417/1827674

MySQL a script to check the running status

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.