mytop 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

mytop 命令安装:


-bash/zsh: mytop command not found

# Windows (WSL2)
sudo apt-get update sudo apt-get install mytop

# Debian
apt-get install mytop

# Ubuntu
apt-get install mytop

# Arch Linux
pacman -S mytop

# Kali Linux
apt-get install mytop

# Fedora
dnf install mytop

# OS X
brew install mytop

# Raspbian
apt-get install mytop

mytop 命令补充说明:


mytop 是一个比较古老的,基于 console 控制台(非 GUI)的工具,用于监视 MySQL 服务器的线程和整体性能。 它可以在大多数安装了 Perl、DBI 和 Term::ReadKey 的 Unix 系统(包括 Mac OS X)上运行。

安装 Term::ANSIColor 后,可以获得颜色显示支持。 如果您安装 Time::HiRes,将获得良好的实时查询/秒统计数据。 从 0.7 版本开始,某种程度上它甚至可以在 Windows 上运行。

mytop 命令语法:


mytop [options]

mytop 命令选项:


-u or -user username
Username to use when logging in to the MySQL server. Default: root.

-p or -pass or -password password
Password to use when logging in to the MySQL server. Default: none.

-h or -host hostname[:port]
Hostname of the MySQL server. The hostname may be followed by an option port number. Note that the port is specified separate from the host when using a config file. Default: localhost.

-port or -P port
If you're running MySQL on a non-standard port, use this to specify the port number. Default: 3306.

-s or -delay seconds
How long between display refreshes. Default: 5

-d or -db or -database database
Use if you'd like mytop to connect to a specific database by default. Default: test.

-b or -batch or -batchmode
In batch mode, mytop runs only once, does not clear the screen, and places no limit on the number of lines it will print. This is suitable for running periodically (perhaps from cron) to capture the information into a file for later viewing. You might use batch mode in a CGI script to occasionally display your MySQL server status on the web.
Default: unset.

-S or -socket /path/to/socket
If you're running mytop on the same host as MySQL, you may wish to have it use the MySQL socket directly rather than a standard TCP/IP connection. If you do,just specify one.
Note that specifying a socket will make mytop ignore any host and/or port that you might have specified. If the socket does not exist (or the file specified is not a socket), this option will be ignored and mytop will use the hostname and port number instead.

Default: none.

-header or -noheader
Sepcify if you want the header to display or not. You can toggle this with the h key while mytop is running.
Default: header.

-color or -nocolor
Specify if you want a color display. This has no effect if you don't have color support available.
Default: If you have color support, mytop will try color unless you tell it not to.

-i or -idle or -noidle
Specify if you want idle (sleeping) threads to appear in the list. If sleeping threads are omitted, the default sorting order is reversed so that the longest running queries appear at the top of the list.

Default: idle.

Command-line arguments will always take precedence over config file options. That happens because the config file is read BEFORE the command-line arguments are applied.

mytop 命令实例:


启动 mytop:

mytop

mytop 使用指定的用户名和密码连接:

mytop -u user -p password

mytop 使用指定的用户名连接(系统将提示用户输入密码):

mytop -u user --prompt

mytop 不显示任何空闲(睡眠)线程:

mytop -u user -p password --noidle

mytop 命令扩展阅读:




mytop 命令评论