From 0bd59c33304ebd518d36431bb70c0858c15edd02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 24 Dec 2009 23:24:23 +0200 Subject: [PATCH 1/4] List users without passwords as user@host, sorted. --- mysqltuner.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index 55013aa..7ab2ec1 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -358,9 +358,9 @@ sub get_all_vars { sub security_recommendations { print "\n-------- Security Recommendations -------------------------------------------\n"; - my @mysqlstatlist = `mysql $mysqllogin -Bse "SELECT user FROM mysql.user WHERE password = '' OR password IS NULL;"`; + my @mysqlstatlist = `mysql $mysqllogin -Bse "SELECT CONCAT(user, '\@', host) FROM mysql.user WHERE password = '' OR password IS NULL;"`; if (@mysqlstatlist) { - foreach my $line (@mysqlstatlist) { + foreach my $line (sort @mysqlstatlist) { chomp($line); badprint "User '".$line."' has no password set.\n"; } From a1d71147595e27019021b2c88ca4bcd4438624ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 6 Mar 2011 12:53:32 +0200 Subject: [PATCH 2/4] Fix detection of Federated engine availability. The variable is have_federated_engine, not have_federated. --- mysqltuner.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index 7ab2ec1..8bc7b56 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -455,7 +455,7 @@ sub check_storage_engines { my $engines; $engines .= (defined $myvar{'have_archive'} && $myvar{'have_archive'} eq "YES")? greenwrap "+Archive " : redwrap "-Archive " ; $engines .= (defined $myvar{'have_bdb'} && $myvar{'have_bdb'} eq "YES")? greenwrap "+BDB " : redwrap "-BDB " ; - $engines .= (defined $myvar{'have_federated'} && $myvar{'have_federated'} eq "YES")? greenwrap "+Federated " : redwrap "-Federated " ; + $engines .= (defined $myvar{'have_federated_engine'} && $myvar{'have_federated_engine'} eq "YES")? greenwrap "+Federated " : redwrap "-Federated " ; $engines .= (defined $myvar{'have_innodb'} && $myvar{'have_innodb'} eq "YES")? greenwrap "+InnoDB " : redwrap "-InnoDB " ; $engines .= (defined $myvar{'have_isam'} && $myvar{'have_isam'} eq "YES")? greenwrap "+ISAM " : redwrap "-ISAM " ; $engines .= (defined $myvar{'have_ndbcluster'} && $myvar{'have_ndbcluster'} eq "YES")? greenwrap "+NDBCluster " : redwrap "-NDBCluster " ; From 4df766729cc8582daa4ba9f28ec9c09fdf7f0752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 6 Mar 2011 12:59:46 +0200 Subject: [PATCH 3/4] Check engine availability also with SHOW ENGINES. have_$engine are deprecated and will be removed in MySQL 5.6, and some of them are either missing in some versions before that or show wrong values - see e.g. MySQL bugs #47286 and #59393. --- mysqltuner.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mysqltuner.pl b/mysqltuner.pl index 8bc7b56..c83c793 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -354,6 +354,22 @@ sub get_all_vars { $line =~ /([a-zA-Z_]*)\s*(.*)/; $mystat{$1} = $2; } + # have_* for engines is deprecated and will be removed in MySQL 5.6; + # check SHOW ENGINES and set corresponding old style variables. + # Also works around MySQL bug #59393 wrt. skip-innodb + my @mysqlenginelist = `mysql $mysqllogin -Bse "SHOW ENGINES;" 2>/dev/null`; + foreach my $line (@mysqlenginelist) { + if ($line =~ /^([a-zA-Z_]+)\s+(\S+)/) { + my $engine = lc($1); + if ($engine eq "federated" || $engine eq "blackhole") { + $engine .= "_engine"; + } elsif ($engine eq "berkeleydb") { + $engine = "bdb"; + } + my $val = ($2 eq "DEFAULT") ? "YES" : $2; + $myvar{"have_$engine"} = $val; + } + } } sub security_recommendations { From 778cc60885ab0901f5a511dc056ef0c22f9f15e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 6 Mar 2011 13:04:08 +0200 Subject: [PATCH 4/4] Work around MySQL bug #59393 wrt. ignore-builtin-innodb. --- mysqltuner.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mysqltuner.pl b/mysqltuner.pl index c83c793..085af70 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -354,6 +354,10 @@ sub get_all_vars { $line =~ /([a-zA-Z_]*)\s*(.*)/; $mystat{$1} = $2; } + # Workaround for MySQL bug #59393 wrt. ignore-builtin-innodb + if (($myvar{'ignore_builtin_innodb'} || "") eq "ON") { + $myvar{'have_innodb'} = "NO"; + } # have_* for engines is deprecated and will be removed in MySQL 5.6; # check SHOW ENGINES and set corresponding old style variables. # Also works around MySQL bug #59393 wrt. skip-innodb