LinuxCommandLibrary

mytop

Monitor system processes in real-time

TLDR

Start mytop

$ mytop
copy

Connect with a specified username and password
$ mytop [[-u|-user]] [user] [[-p|-password]] [password]
copy

Connect with a specified username (the user will be prompted for a password)
$ mytop [[-u|-user]] [user] -prompt
copy

Do not show any idle (sleeping) threads
$ mytop [[-u|-user]] [user] [[-p|-password]] [password] --noidle
copy

SYNOPSIS

mytop [-d database] [-h host] [-p port] [-u user] [-P password] [-s delay] [-n iterations] [-b]

PARAMETERS

-d database
    The database to connect to. If not specified, connects to all databases.

-h host
    The MySQL/MariaDB server host. Defaults to 'localhost'.

-p port
    The MySQL/MariaDB server port. Defaults to 3306.

-u user
    The MySQL/MariaDB server username.

-P password
    The MySQL/MariaDB server password.

-s delay
    The delay in seconds between screen updates. Defaults to 5 seconds.

-n iterations
    The number of iterations to run before exiting. If not specified, runs indefinitely.

-b
    Batch mode. Outputs data to standard output without screen clearing. Useful for scripting.

DESCRIPTION

mytop is a command-line utility for monitoring the performance of MySQL or MariaDB servers in real-time. It provides a dynamic, top-like display of active threads, queries, and overall server status.
It allows administrators and developers to quickly identify performance bottlenecks, long-running queries, and resource-intensive processes affecting the database. mytop connects to the MySQL/MariaDB server and periodically updates its display with metrics such as CPU usage, query counts, slow queries, and table locks. It also lists the currently running queries with information about the user, host, and execution time.
The information is organized in a concise and readable format, making it easy to identify problematic queries. It helps diagnose database performance issues and optimize queries for better efficiency.
Note: MyTop is considered somewhat abandoned. Maintained versions are available or modern alternatives such as `pt-top` are recommended.

CAVEATS

Requires MySQL client libraries and appropriate user privileges to connect to the MySQL/MariaDB server. The accuracy of the data depends on the server's configuration and load.

KEY DISPLAY INFORMATION

Threads: Shows the total number of threads connected to the MySQL server.
Queries: Displays the total number of queries executed.
Slow: Indicates the number of slow queries that exceeded the `long_query_time` threshold.
Current Queries: Displays the current running queries and their status.

INTERACTIVE COMMANDS

mytop provides interactive commands, typically single key presses, to alter the display and filtering of the data shown.

SEE ALSO

mysql(1), mariadb(1), pt-top(1)

Copied to clipboard