mytop 是一个类似 Linux 下的 top 命令风格的 MySQL 监控工具,可以监控当前的连接用户和正在执行的命令。
1. 安装TermReadKey 下载地址:http://search.cpan.org/CPAN/authors/id/J/JS/JSTOWE/TermReadKey-2.30.tar.gz 安装: tar xzvf TermReadKey cd TermReadKey perl Makefile.pl make make test make install
2. 安装DBI 下载地址:http://cpan.uwinnipeg.ca/dist/DBI 安装: tar xzvf DBI-1.615.tar.gz cd DBI-1.615 perl Makefile.pl make make test make install
3. 安装Mytop 下载地址:http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz 安装: tar xzvf mytop-1.6.tar.gz cd mytop-1.6 perl Makefile.pl make make test make install
4.执行 mytop -uroot -pxxxxx 可能会出现报错: MySQL on localhost (5.1.43-log) up 345+20:36:31 [09:07:11] Queries: 3.0 qps: 0 Slow: 0.0 Se/In/Up/De(%): 00/00/00/00
Key Efficiency: 100.0% Bps in/out: 0.0/ 0.0
Id User Host/IP DB Time Cmd Query or State -- ---- ------- -- ---- --- ---------- Use of uninitialized value in substitution (s///) at ./mytop line 955. Use of uninitialized value in substitution (s///) at ./mytop line 955. ................................................... Use of uninitialized value in substitution (s///) at ./mytop line 955.