Index: mytop-1.6/mytop =================================================================== --- mytop-1.6.orig/mytop +++ mytop-1.6/mytop @@ -262,18 +262,21 @@ ReadMode($RM_RESET) unless $config{batch ## Get static data -my $db_version; my $have_query_cache; -my @variables = Hashes("show variables"); +my @ver = Hashes("select version() as ver"); +my $db_version = $ver[0]->{ver}; +my $global = ''; + +if ($db_version =~ /^5/) +{ + $global = 'global'; +} + +my @variables = Hashes("show $global variables"); foreach (@variables) { - if ($_->{Variable_name} eq "version") - { - $db_version = $_->{Value}; - next; - } if ($_->{Variable_name} eq "have_query_cache") { if ($_->{Value} eq 'YES') @@ -710,7 +713,7 @@ sub GetData() ## if ($config{header}) { - my @recs = Hashes("show status"); + my @recs = Hashes("show $global status"); ## if the server died or we lost connectivity if (not @recs)