PERCONA-TOOLKIT(1)
๐ PERCONA-TOOLKIT(1) โจ
๐ NAME
percona-toolkit โ Advanced command-line tools for MySQL ๐ซถ
๐ธ DESCRIPTION
Okay so bestie, Percona Toolkit is a whole collection of advanced command-line tools used by Percona support staff (<http://www.percona.com/>) to do a bunch of MySQL and system tasks that are honestly too difficult or complex to do by hand. No cap. ๐ญ
These tools are ideal alternatives to private or โone-offโ scripts because they are professionally developed, formally tested, and fully documented. They are also fully self-contained, so installation is quick and easy and no libraries are installed. Itโs giving polished, lowkey iconic, and highkey practical. โจ
Percona Toolkit is derived from Maatkit and Aspersa, two of the best-known toolkits for MySQL server administration. It is developed and supported by Percona. For more information and other free, open-source software developed by Percona, visit <http://www.percona.com/software/>. ๐
๐ TOOLS
This release of Percona Toolkit includes the following tools:
pt-alignโ Align output from other tools to columns.pt-archiverโ Archive rows from a MySQL table into another table or a file.pt-config-diffโ Diff MySQL configuration files and server variables.pt-deadlock-loggerโ Log MySQL deadlocks.pt-diskstatsโ An interactive I/O monitoring tool for GNU/Linux.pt-duplicate-key-checkerโ Find duplicate indexes and foreign keys on MySQL tables.pt-eustack-resolverโ Get stack traces for a selected program with eu-stack and resolve symbols.pt-fifo-splitโ Split files and pipe lines to a fifo without really splitting.pt-findโ Find MySQL tables and execute actions, like GNU find.pt-fingerprintโ Convert queries into fingerprints.pt-fk-error-loggerโ Log MySQL foreign key errors.pt-galera-log-explainerโ Filter, aggregate and summarize multiple galera logs together.pt-heartbeatโ Monitor MySQL replication delay.pt-index-usageโ Read queries from a log and analyze how they use indexes.pt-ioprofileโ Watch process IO and print a table of file and I/O activity.pt-k8s-debug-collectorโ Collect debug data from a k8s/OpenShift cluster.pt-killโ Kill MySQL queries that match certain criteria.pt-mextโ Look at many samples of MySQLSHOW GLOBAL STATUSside-by-side.pt-mongodb-index-checkโ Performs checks on MongoDB indexes.pt-mongodb-query-digestโ Reports query usage statistics by aggregating queries from MongoDB query profiler.pt-mongodb-summaryโ Collect information about a MongoDB cluster.pt-mysql-summaryโ Summarize MySQL information nicely.pt-online-schema-changeโALTERtables without locking them.pt-pg-summaryโ Collect information about a PostgreSQL cluster.pt-pmpโ Aggregate GDB stack traces for a selected program.pt-query-digestโ Analyze MySQL queries from logs, processlist, and tcpdump.pt-secure-collectโ Collect, sanitize, pack and encrypt data.pt-show-grantsโ Canonicalize and print MySQL grants so you can effectively replicate, compare and version-control them.pt-siftโ Browses files created bypt-stalk.pt-slave-delayโ Make a MySQL slave server lag behind its master.pt-slave-findโ Find and print replication hierarchy tree of MySQL slaves.pt-slave-restartโ Watch and restart MySQL replication after errors.pt-stalkโ Collect forensic data about MySQL when problems occur.pt-summaryโ Summarize system information nicely.pt-table-checksumโ Verify MySQL replication integrity.pt-table-syncโ Synchronize MySQL table data efficiently.pt-table-usageโ Analyze how queries use tables.pt-upgradeโ Verify that query results are identical on different servers.pt-variable-advisorโ Analyze MySQL variables and advise on possible problems.pt-visual-explainโ FormatEXPLAINoutput as a tree.
For more free, open-source software developed by Percona, visit <http://www.percona.com/software/>. ๐
๐ฎ SPECIAL OPTION TYPES
Tool options use standard types (int, string, etc.) as well as these special types:
timeโ Time values are seconds by default. For example,--run-time 60means 60 seconds. Time values support an optional suffix:s(seconds),m(minutes),h(hours),d(days).--run-time 1mmeans 1 minute (the same as 60 seconds). โฐsizeโ Size values are bytes by default. For example,--disk-space-free 1024means 1 Kibibyte. Size values support an optional suffix:k(Kibibyte),M(Mebibyte),G(Gibibyte). ๐DSNโ See โDSN (DATA SOURCE NAME) SPECIFICATIONSโ.Hash,hash,Array,arrayโHash,hash,Array, andarrayvalues are comma-separated lists of values. For example,--ignore-tables foo,barignores tablesfooandbar.
๐๏ธ CONFIGURATION FILES
Percona Toolkit tools can read options from configuration files. The configuration file syntax is simple and direct, and bears some resemblances to the MySQL command-line client tools. The configuration files all follow the same conventions. ๐
Internally, what actually happens is that the lines are read from the file and then added as command-line options and arguments to the tool, so just think of the configuration files as a way to write your command lines. Itโs literally command-line energy, but stored in a file. โจ
๐ธ SYNTAX
The syntax of the configuration files is as follows:
- Whitespace followed by a hash sign (
#) signifies that the rest of the line is a comment. This is deleted. For example: - Whitespace is stripped from the beginning and end of all lines.
- Empty lines are ignored.
- Each line is permitted to be in either of the following formats:
option
option=value
Do not prefix the option with --. Do not quote the values, even if it has spaces; values are literal. Whitespace around the equals sign is deleted during processing.
- Only long options are recognized.
- A line containing only two hyphens (
--) signals the end of option parsing. Any further lines are interpreted as additional arguments (not options) to the program.
๐งช EXAMPLE
This config file for pt-stalk,
# Config for pt-stalk
variable=Threads_connected
cycles=2 # trigger if problem seen twice in a row
--
--user daniel
is equivalent to this command line:
pt-stalk --variable Threads_connected --cycles 2 -- --user daniel
Options after -- are passed literally to mysql and mysqladmin. ๐ซถ
๐ READ ORDER
The tools read several configuration files in order:
- The global Percona Toolkit configuration file,
/etc/percona-toolkit/percona-toolkit.conf. All tools read this file, so you should only add options to it that you want to apply to all tools. - The global tool-specific configuration file,
/etc/percona-toolkit/TOOL.conf, whereTOOLis a tool name likept-query-digest. This file is named after the specific tool youโre using, so you can add options that apply only to that tool. - The userโs own Percona Toolkit configuration file,
$HOME/.percona-toolkit.conf. All tools read this file, so you should only add options to it that you want to apply to all tools. - The userโs tool-specific configuration file,
$HOME/.TOOL.conf, whereTOOLis a tool name likept-query-digest. This file is named after the specific tool youโre using, so you can add options that apply only to that tool. ๐
๐ฏ SPECIFYING
There is a special --config option, which lets you specify which configuration files Percona Toolkit should read. You specify a comma-separated list of files. However, its behavior is not like other command-line options. It must be given first on the command line, before any other options. If you try to specify it anywhere else, it will cause an error. Also, you cannot specify --config=/path/to/file; you must specify the option and the path to the file separated by whitespace without an equal sign between them, like:
--config /path/to/file
If you donโt want any configuration files at all, specify --config '' to provide an empty list of files. ๐
๐ DSN (DATA SOURCE NAME) SPECIFICATIONS ๐
okay so this is the part where we talk about DSNs, and bestie, they're literally the whole personality of Percona Toolkit tools โ they tell a tool how to build a DBD connection to a MySQL server. A DSN is just a comma-separated string of key=value parts, like:
h=host1,P=3306,u=bob
The standard key parts are listed down below, but some tools add extra ones for the plot, so check each tool's docs for those. iykyk.
Some tools don't do DSNs at all and still connect to MySQL using options like --host, --user, and --password. Those tools take those options and create a DSN automatically behind the scenes. sneaky but cute.
Other tools use both DSNs and options like the ones up there. In that case the options are basically giving defaults to every DSN that doesn't specify that option's corresponding key part. Example: if DSN is h=host1 and you also pass --port=12345, the tool automatically adds P=12345 to the DSN. teamwork!
๐ ESCAPING VALUES โจ
DSNs usually get typed on the command line, so shell quoting and escaping are absolutely part of the vibe check. Special characters like the asterisk (*) need to be quoted and/or escaped properly if you want them to come through as literal characters in DSN values.
And here's the tricky part โ since DSN parts are separated by commas, literal commas inside DSN values must be escaped with a single backslash (\). But because a backslash is the escape character for most shells, you need two backslashes to actually pass a literal backslash. So if your username is literally my,name, on most shells you have to write it as my\\,name. This applies to DSNs and to DSN-related options like --user. no cap, write it down.
๐ KEY PARTS ๐
Many tools add more parts to DSNs for special purposes, and sometimes they override parts so they do something slightly different. But all the tools support at least these:
Aโ default character set for the connection (SET NAMES). This turns on character set settings in both Perl and MySQL. If the value isutf8, it sets Perl's binmode on STDOUT to utf8, passes themysql_enable_utf8option to DBD::mysql, and runsSET NAMES 'utf8'after connecting to MySQL. Any other value sets binmode on STDOUT without the utf8 layer and runsSET NAMESafter connecting to MySQL. Sad part: there's genuinely no way from inside Perl itself to specify the client library's character set ๐ญSET NAMESonly affects the server, so if the client library's settings don't match, problems can happen. You can use the defaults file to specify the client library's character set though โ see theFpart below.Dโ default database to use when connecting. Tools mayUSEa different database while running, so don't get too attached.Fโ defaults file for the MySQL client library (that's the C client library used by DBD::mysql, not Percona Toolkit itself). All tools read the[client]section within the defaults file. If you omit this, the standard defaults files get read in the usual order. "Standard" varies from system to system because the filenames to read are compiled into the client library. On Debian systems, for example, it's usually/etc/mysql/my.cnfthen~/.my.cnf. If you drop this into~/.my.cnf, you won't have to type your MySQL username and password on the command line:
[client]
user=your_user_name
pass=secret
Omitting the F part is usually the right thing to do. As long as you've configured your ~/.my.cnf correctly, the tools will connect automatically without needing a username or password. slay.
You can also specify a default character set in the defaults file. Unlike the A part above, this actually instructs the client library (DBD::mysql) to change the character set it uses internally โ and there's no other way to accomplish that. icon behavior only.
hโ MySQL hostname or IP address to connect to.Lโ explicitly enable LOAD DATA LOCAL INFILE. For some reason, some vendors compile libmysql without the--enable-local-infileoption, which disables the statement. That leads to truly cursed situations, like the server allowing LOCAL INFILE but the client throwing exceptions when it's used ๐ The good news: as long as the server allows LOAD DATA, clients can easily re-enable it. Seehttps://dev.mysql.com/doc/refman/en/load-data-local-security.htmlandhttp://search.cpan.org/~capttofu/DBD-mysql/lib/DBD/mysql.pm. This option does exactly that.pโ MySQL password to use when connecting.Pโ port number to use for the connection. Note the usual special-case behaviors apply: if you specifylocalhostas your hostname on Unix systems, the connection actually uses a socket file, not a TCP/IP connection, and therefore ignores the port. rude but consistent.Sโ MySQL socket file to use for the connection (on Unix systems).uโ MySQL username to use when connecting, if not the current system user.sโ create SSL connection ๐
๐ฃ๏ธ BAREWORD ๐ธ
Many tools let you specify a DSN as a single word, with zero key=value syntax. That's called a 'bareword'. How it's handled is tool-specific, but it's usually interpreted as the h part. The tool's --help output will tell you the behavior for that specific tool. main character energy, honestly.
๐ซถ PROPAGATION ๐ฆ
Many tools let you propagate values from one DSN to the next so you don't have to spell out every part of every DSN. For example, if you want to specify a username and password for each DSN, you can connect to three hosts like this:
h=host1,u=fred,p=wilma host2 host3
This is tool-specific, so peek at the docs. ๐
๐ ENVIRONMENT โญ
The environment variable PTDEBUG enables verbose debugging output to STDERR. To enable debugging and capture all output to a file, run the tool like:
PTDEBUG=1 pt-table-checksum ... > FILE 2>&1
โ ๏ธ Be careful: debugging output is voluminous and can generate several megabytes of output. like, gigabytes-of-vibes levels of output. hydrate and check your disk space.
๐ง SYSTEM REQUIREMENTS ๐
Most tools require:
- Perl v5.8 or newer
- Bash v3 or newer
- Core Perl modules like Time::HiRes
Tools that connect to MySQL require:
- Perl modules DBI and DBD::mysql
- MySQL 5.0 or newer
Percona Toolkit officially supports and is tested on many popular Linux distributions and MySQL 5.0 through 5.6; see http://goo.gl/srHm7 for the list of supported platforms and versions.
๐ IPv6 support ๐ฆ
In order to support IPv6 addresses to connect to MySQL, Perl DBD::MySQL driver v4.033_01 is required. Also, as stated in RFC 3986 https://www.ietf.org/rfc/rfc3986.txt section 3.2.2, brackets must be used to distinguish host and port. Examples here: https://metacpan.org/pod/DBD::mysql#port. brackets are the moment, don't skip them.
๐ BUGS ๐ญ
Please report bugs at https://jira.percona.com. Include the following info in your bug report:
- Complete command-line used to run the tool
- Tool
--version - MySQL, MongoDB, or PostgreSQL version of all servers involved
- Output from the tool including STDERR
- Input files (log/dump/config files, etc.)
If possible, include debugging output by running the tool with PTDEBUG; see "ENVIRONMENT" above. the maintainers will love you for it fr fr.
๐ AUTHORS ๐
- Baron Schwartz โ Baron created Maatkit, from which Percona Toolkit was forked. Many of the tools and modules were originally written by Baron.
- Daniel Nichter โ Daniel was the project's lead developer from 2008 until 2016.
- Frank Cizmich โ Frank was a full-time Percona Toolkit developer employed by Percona until 2016.
- Carlos Salguero โ Carlos was the project's lead developer from 2016 until 2022.
- Sveta Smirnova โ Sveta is the project's lead developer since 2022.
- Others โ many people have contributed code over the years. See each tool's
AUTHORSsection for details.
legends, all of them. ๐ซถ
๐ COPYRIGHT, LICENSE, AND WARRANTY ๐
Percona Toolkit is copyright 2011-2026 Percona LLC and/or its affiliates, et al. See each program's documentation for complete copyright notices.
THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2; OR the Perl Artistic License. On UNIX and similar systems, you can issue man perlgpl or man perlartistic to read these licenses.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
โญ VERSION ๐
Percona Toolkit v3.7.1-4 released 2026-07-02
okay that's the whole page bestie, you made it to the end ๐ this edition came from perl v5.42.2, dated 2026-09-01, and it's the PERCONA-TOOLKIT(1) manual page โ go forth and connect to things responsibly ๐โจ
๐ฆ where this page comes from
- arch rolling: percona-toolkit 3.7.1_4-1 ยท GPL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms