|<B>-uB> or <B>-userB> username||Username to use when logging in to the MySQL server. Default: root.|
|<B>-pB> or <B>-passB> or <B>-passwordB> password||Password to use when logging in to the MySQL server. Default: none.|
|<B>-hB> or <B>-hostB> 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.|
|<B>-portB> or <B>-PB> port||If youre running MySQL on a non-standard port, use this to specify the port number. Default: 3306.|
|<B>-sB> or <B>-delayB> seconds||How long between display refreshes. Default: 5|
|<B>-dB> or <B>-dbB> or <B>-databaseB> database||Use if youd like <B>mytopB> to connect to a specific database by default. Default: test.|
|<B>-bB> or <B>-batchB> or <B>-batchmodeB>||
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
|<B>-SB> or <B>-socketB> /path/to/socket||
If youre running <B>mytopB> 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 <B>mytopB> 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 <B>mytopB> will use the hostname and port number instead.
|<B>-headerB> or <B>-noheaderB>||
Sepcify if you want the header to display or not. You can toggle this
with the <B>hB> key while <B>mytopB> is running.
|<B>-colorB> or <B>-nocolorB>||Specify if you want a color display. This has no effect if you dont have color support available.|
|<B>-iB> or <B>-idleB> or <B>-noidleB>||
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.
|<B>-promptB> or <B>-nopromptB>||
Specify if you want to be prompted to type in your database password.
This provides a little bit more security since it not only prevents
the password from viewable in a process list, but also doesnt require
the password to be stored in plain text in your ~/.mytop config file.
You will <B>onlyB> be prompted if a password has not been specified in
your config file or through another command line option.
If you have skip-resolve set on MySQL (to keep it from doing a reverse
DNS lookup on each inbound connection), mytop can replace IP addresses
with hostnames but toggling this option.
Instead of always using bulky command-line parameters, you can also use a config file in your home directory (~/.mytop). If present, <B>mytopB> 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.
user=root pass= host=localhost db=test delay=5 port=3306 socket= batchmode=0 header=1 color=1 idle=1
Using a config file will help to ensure that your database password isnt 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.
The following keys perform various actions while <B>mytopB> is running. Those which have not been implemented are listed as such. They are included to give the user idea of what is coming.
The <B>sB> key has a command-line counterpart: <B>-sB>.
<B>?B> Display help. <B>cB> Show command counters based on the Com_* values in SHOW GLOBAL STATUS. This is a new feature. Feedback welcome. <B>dB> Show only threads connected to a particular database. <B>fB> Given a thread id, display the entire query that thread was (and still may be) running. <B>FB> Disable all filtering (host, user, and db). <B>hB> Only show queries from a particular host. <B>HB> Toggle the header display. You can also specify either header=0 or header=1 in your config file to set the default behavior. <B>iB> Toggle the display of idle (sleeping) threads. If sleeping threads are filtered, the default sorting order is reversed so that the longest running queries appear at the top of the list. <B>IB> Switch to InnoDB Status mode. The output of SHOW INNODB STATUS will be displayed every cycle. In a future version, this may actually summarize that data rather than producing raw output. <B>kB> Kill a thread. <B>mB> Toggle modes. Currently this switches from top mode to qps (Queries Per Second Mode). In this mode, mytop will write out one integer per second. The number written reflects the number of queries executed by the server in the previous one second interval.
More modes may be added in the future.
<B>oB> Reverse the default sort order. <B>pB> Pause display. <B>qB> Quit <B>mytopB> <B>rB> Reset the servers status counters via a FLUSH STATUS command. <B>sB> Change the sleep time (number of seconds between display refreshes). <B>uB> Show only threads owned by a giver user.
This is more of a BUGS + WishList.
Some performance information is not available when talking to a version 3.22.x MySQL server. Additional information (about threads mostly) was added to the output of SHOW STATUS in MySQL 3.23.x and <B>mytopB> makes use of it. If the information is not available, you will simply see zeros where the real numbers should be.
Simply running this program will increase your overall counters (such as the number of queries run). But you may or may not view that as a bug.
<B>mytopB> consumes too much CPU time when running (verified on older versions of Linux and FreeBSD). Its likely a problem related to Term::ReadKey. I havent had time to investigate yet, so <B>mytopB> now automatically lowers its priority when you run it. You may also think about running <B>mytopB> on another workstation instead of your database server. However, mytop on Solaris does <B>notB> have this problem. Newer versions of Linux and FreeBSD seem to have fixed this.
The size of most of the columns in the display has a small maximum width. If you have fairly long database/user/host names the display may appear odd. I have no good idea as to how best to deal with that yet. Suggestions are welcome.
You should be able to specify the columns youd like to see in the display and the order in which they appear. If you only have one username that connects to your database, its probably not worth having the User column appear, for example.
mytop was developed and is maintained by Jeremy D. Zawodny (Jeremy@Zawodny.com).
While I use this software in my job at Yahoo!, I am solely responsible for it. Yahoo! does not necessarily support this software in any way. It is merely a personal idea which happened to be very useful in my job.
If you hack Perl and grok MySQL, come work at Yahoo! Contact me for details. Or just send me your resume. Er, unless we just had layoffs, in which case were not hiring. :-(
Please check the MySQL manual if youre not sure where some of the output of <B>mytopB> is coming from.
Copyright (C) 2000-2001, Jeremy D. Zawodny.
Fix a bug. Add a feature. See your name here!
Many thanks go to these fine folks:
See the Changes file on the <B>mytopB> distribution page for more details on what has changed.
Sami Ahlroos (firstname.lastname@example.org) Suggested the idle/noidle stuff. Jan Willamowius (email@example.com) Mirnor bug report. Documentation fixes. Alex Osipov (firstname.lastname@example.org) Long command-line options, Unix socket support. Stephane Enten (email@example.com) Suggested batch mode. Richard Ellerbrock (firstname.lastname@example.org) Bug reports and usability suggestions. William R. Mattil (email@example.com) Bug report about empty passwords not working. Benjamin Pflugmann (firstname.lastname@example.org) Suggested -P command-line flag as well as other changes. Justin Mecham <email@example.com> Suggested setting $0 to mytop. Thorsten Kunz <firstname.lastname@example.org> Provided a fix for cases when we try remove the domain name from the display even if it is actually an IP address. Sasha Pachev <email@example.com> Provided the idea of real-time queries per second in the main display. Paul DuBois <firstname.lastname@example.org> Pointed out some option-handling bugs. Mike Wexler <email@example.com> Suggested that we dont mangle (normalize) whitespace in query info by default. Mark Zweifel <firstname.lastname@example.org> Make the --idle command-line argument negatable. Axel Schwenke <email@example.com> Noticed the inccorect formula for query cache hit percentages in version 1.2. Steven Roussey <firstname.lastname@example.org> Supplied a patch to help filter binary junk in queries so that terminals dont freak out. jon r. luini <email@example.com> Supplied a patch that formed the basis for -prompt support. Sean Leach <firstname.lastname@example.org> submitted a similar patch. Yogish Baliga <email@example.com> Supplied a patch that formed the basis for -resolve support. Per Andreas Buer <firstname.lastname@example.org> Supplied an excellent patch to tidy up the top display. This includes showing most values in short form, such as 10k rather than 10000.
<B>mytopB> is licensed under the GNU General Public License version 2. For the full license information, please visit http://www.gnu.org/copyleft/gpl.html
|perl v5.20.3||MYTOP (1)||2016-04-03|