How to enable compression with MySQL and Perl

To enable compression for data transfer when using the Perl MySQL modules DBI & DBD::mysql alter your connect statement from:

my $dbHandle = DBI->connect("DBI:mysql:database=mydb;host=myhost", "user", "pass");

To this:

my $dbHandle = DBI->connect("DBI:mysql:database=mydb;host=myhost;mysql_compression=1", "user", "pass");

That's it, use tcpdump to check if it is actually being used.

Last updated: 18/09/2005