Stefan Seidel

Debian Squeeze, mytop and Mysql Server 5.1

After having updated most servers to Debian Squeeze (6.0), I noticed that the packaged mytop utility didn't work with the new mysql-server-5.1. After looking for a solution for a long time, I found out that the variable name for the number of queries has changed in 5.1 - from "Questions" to "Queries" (or maybe the other way round). Thus, a dirty solution is to apply the following patch to /usr/bin/mytop:

--- /usr/bin/mytop	2009-04-06 23:49:09.000000000 +0200
+++ mytop	2011-08-18 10:54:09.000000000 +0200
@@ -794,6 +794,11 @@
         {
             my $key = $ref->{Variable_name};
             my $val = $ref->{Value};
+	    if ($key eq 'Queries') {
+		$key = 'Questions';
+	    } else { if ($key eq 'Questions') {
+		$key = 'Queries';
+	    } }
 
             $STATUS{$key} = $val;
         }

This solved it for me. Of course, the correct solution would be to check the MySQL version and act accordingly, but I leave that as an exercise to the reader :)