In order for mytop to function properly, you must have the following:
* Perl 5.005 or newer
* DBI and DBD::mysql
* Term::ReadKey from CPAN
Install mytop in Ubuntu
sudo aptitude install mytop
This will complete the installation
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.
-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.
-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.
-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.
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 Config File
Instead of always using bulky command-line parameters, you can also use a config file in your home directory (~/.mytop). If present, mytop will read it automatically. It is read before any of your command-line arguments are processed, so your command-line arguments will override directives in the config file.
Here is a sample config file ~/.mytop which implements the defaults described above.
Using a config file will help to ensure that your database password isn't visible to users on the command-line. Just make sure that the permissions on ~/.mytop are such that others cannot read it (unless you want them to, of course).
You may have white space on either side of the = in lines of the config file.
Sample Output look like below
Incoming search terms:
- mytop ubuntu
- ubuntu mytop
- ubuntu mysql monitor
- mytop config
- mytop syntax
- mytop command line
- mysql query monitor
- install mytop ubuntu
- sintaxe do mytop