BANGALORE, INDIA: MySQL comes packaged with some command-line utilities that help manage a MySQL environment. Also, there are some additional MySQL GUI tools that help you do the same. But the functionalities of these tools are limited and you can't do everything to monitor the MySQL database.
For instance, if you want to ensure that the data in tables that are being replicated between master and slave servers is consistent, then checksum is an easy way, which MySQL lacks. Before firing a query one would like to know the exact implications of its execution. A query profiler can tell you how much load your query is going to cost to the database server. Such utilities if present in MySQL, can really be handy for MySQL users.
About Maatkit
Maatkit, formerly MySQL Toolkit, makes MySQL easier to manage, and is supported on both Linux as well as Windows. With tools that are missing in MySQL, Maatkit lets you check replication, perform query profiling, have a visual representation of EXPLAIN output, and much more. Maatkit commands are Perl scripts, thus making installation of Perl a prerequisite.
You can download the tools package of Maatkit from Google Code at http://bit.ly/zlorb and find documentation for its commands at Maatkit.org. The commands documentation can also be viewed by using PerlDoc command. Let's get started with Maatkit by installing it for MySQL on a Windows platform.
Getting started
As said earlier, Perl is a prerequisite to be installed on your system having MySQL server before you start using Maatkit. For this demonstration, we are using MySQL 6.0 on a Windows Vista machine and ActivePerl (www.activestate.com) for Perl installation. Once ActivePerl is installed, you have to install the Database Interface (DBI) for Perl, which can be done by running the ppm install DBI command from the bin folder of base install directory of Perl (default is C:\Perl).
Now to interact with MySQL database, you need to install database drivers for Perl's DBI. The ActivePerl has many packages that can be downloaded and installed, and it lists database drivers for MySQL as well. Through Perl Package Manager, you can select DBD-mysql from the All Packages list and mark it for installation. Now you can install the selected Perl driver for MySQL database by clicking on the Run Marked action.
 |
|
Through Perl Package Manager, install the database driver for MySQL. It can be found in 'All Packages List' and then the driver can be marked for installation.
|
Alternatively, you can install the DBD-mysql driver through this command:
C:\Perl\bin>ppm install http://cpan.uwinnipeg.ca/PPMPackages/10xx/DBD-mysql.ppd
Now you are set for Maatkit installation. Maatkit is available as a zipped file for download. Download and extract it, and you are ready to use it. All you need is to run the Makefile script before using Maatkit commands. Go to the base folder of Maatkit directory and execute Makefile script as follows:
C:\maatkit-4334> perl Makefile.PL
Now you can start using various Maatkit tools/commands for MySQL management. For the Maatkit tools demonstration, you can use a demo database( called sakila database) which is provided by MySQL. You can download it from bit.ly/3EoEyL and import onto MySQL using SOURCE command.