MySQL Common script

Source: Internet
Author: User

Compiled some common MySQL scripts that can be used for monitoring. Not regularly updated ...


Check Lock:

More check_lock.sh#!bin/bashwhile truedo  mysql -u root -p123456_ -h  < ~/script/check_lock.sql  >> ~/script/html/' date + "%Y%m%d" ' w11.html   sleep 1donemore check_lock.sql SELECT r.trx_id waiting_trx_id,          r.trx_mysql_thread_id waiting_thread,        r.trx_query waiting_query,       b.trx_id  blocking_trx_id,        b.trx_mysql_thread_id blocking_ Thread,       b.trx_query blocking_query,now ()    FROM        information_schema.innodb_lock_waits w   inner  join information_schema.innodb_trx b  on      b.trx_id  = w.blocking_trx_id  inner join information_schema.innodb_trx r  on       r.trx_id = w.requesting_trx_id;

Check process

check_proc.sh #!/bin/bashwhile Truedo mysql-u root-p123456_ h < ~/script/check_proc.sql >> ~/script/html/pro C_ ' date + '%y%m%d%h '. HTML sleep 2donecat Check_proc.sql Select Now (), Id,user,host,db,command,time,state,info from Information_schema.processlist where command not in (' Sleep ', ' Binlog Dump ') and INFO not like '%information_schema.proces Slist% ';


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/1920342

MySQL Common script

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.