Wednesday, October 1, 2008

Windows and maatkit

There are some great tools out there for MySQl. Many of them can be very Linux specific. Maatkit, which was originally written by Baron Schwartz and now maintained by the company he works for Percona, generally works on Windows too. It does have some specific tools like mk-audit that are Linux specific.

This article will be about getting Maatkit installed on your server and future articles will talk about functionality.

You are going to need a couple things to get this going. You will need Maatkit, Perl, DBI, DBD-mysql and some core packages to get yourself going.

First, you will need maatkit. Unzip the package to a directory of your choice. Something like c:\maatkit-2325
http://www.maatkit.org/

Second, you will need Perl. I would recommend getting Activeperl from http://www.activestate.com/. The current version is Activeperl 10. If you are using an x64 version of Windows like you should be, you will still want to get the x86 package of Activeperl to get this working. Download and Install.

Open a command prompt and navigate to the install directory. Most likely: C:\Perl\

C:\> cd Perl
C:\Perl>cd bin
C:\Perl\bin>

Third, we will want to make sure DBI is installed and then install DBD-mysql. This version of DBD-mysql will be specific to Activeperl 10.

C:\Perl\bin>ppm install DBI
C:\Perl\bin>ppm install http://cpan.uwinnipeg.ca/PPMPackages/10xx/DBD-mysql.ppd

As long as you didn't run into any snags you should be set. You can now run Perl scripts and maatkit.

To test:
C:\maatkit-2325>C:\Perl\bin\perl.exe mk-table-checksum --databases db1,db2 h=localhost,u=root,p=password

This will run a checksum on your specified databases, in this case db1 and db2.

Hint: You will also be able to run things in the MySQL/scripts folder like mysqldumpslow.

1 comment:

Lazybones said...

Thanks a lot, very useful post.