MySQL Slow query analysis tool: Pt-query-digest for installation on Mac

Source: Internet
Author: User
Tags percona

System performance tuning in particular MySQL database tuning a primary basis is the slow query log. Originally there is a powerful tool on Ubantu or CentOS is Percona Toolkit, then how to use Pt-query-digest on Mac?

Download Percona Toolkit

Access Http://www.percona.com/downloads/percona-toolkit, use source code installation, download the latest stable version of 2.2.7.

650) this.width=650; "src=" http://img.blog.csdn.net/20160608212319520 "alt=" here write a picture describing "title=" "style=" border:none; "/ >

Install and pre-fill the holes in the installation process

Go to the download directory and open the training:

$ tar xvfz percona-toolkit-2.2.7.tar.gz$ CD percona-toolkit-2.2.171212

Note that the Perl version is more than 5.18.

Perl, the language of passion years ago, hehe. Try running Perl makefile.pl and look at the output:

Checking If your kit is complete ... Looks goodwarning:prerequisite dbd::mysql 3 not found. Warning:prerequisite DBI 1.46 not found.  Warning:name must be a package namegenerating a unix-style makefilewriting Makefile for percona-toolkitwriting MYMETA.yml and mymeta.json123456789101112131415123456789101112131415

Attention to these several warning, may be the pit, especially the dbd and dbi, without them, how to achieve database connection? Install the relevant Perl module.

$ perl-mcpan-e "Install DBI" $ perl-mcpan-e "Install Dbd::mysql" 1212

Note that if there is a permission problem, use sudo.

Now, Percona Toolkit can be installed, especially the path of mysql_config is specified.

$ perl makefile.pl--mysql_config=/local/mariadb/bin/mysql_config11

Then, the well-known make and make install is installed, and the installation is complete.

Inspection and use

There are two ways to test the installed module in Perl: One is to execute the command Perldoc perllocal, the other is to execute instmodsh, and for simplicity, here with INSTMODSH, run and output as follows:

$ instmodshavailable commands are:   l             - List all installed modules   m < module>   - select a module   q             - quit the programcmd? linstalled modules  are:   authen::sasl   cgi   cwd   dbd::mysql    DBI   Digest::HMAC   Digest::SHA1   Error    file::slurp::tiny   gssapi   git   html::P arser    HTML::Tagset   IO::Socket::SSL   Locale::gettext    NET::LIBIDN&NBSP;&NBSP;&NBSP;NET::SMTP::SSL&NBSP;&NBSP;&NBSP;NET::SSLEAY&NBSP;&NBSP;&NBSP, ..... 12345678910111213141516171819202122232425261234567891011121314151617181920212223242526 

Now you can use Percona Toolkit on your Mac like any other Linux platform. Back to the target topic, analyze slow queries:

$ pt-query-digest ~/mysql-slow.log11

Remote execution will be slow, here is to drag the slow query log to run locally, you can get more valuable analysis results.

This article from "I Believe" blog, reproduced please contact the author!

MySQL Slow query analysis tool: Pt-query-digest for installation on Mac

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.