From 066acb0940bebc3224a531e66b5daee09888f4d8 Mon Sep 17 00:00:00 2001 From: Billy Noah Date: Tue, 10 Sep 2019 16:06:58 -0400 Subject: [PATCH] Update mysqltuner.pl Check to make sure mysql.user has a column called 'password'. Adjust security_recommendations queries accordingly. This should address issues: https://github.com/major/MySQLTuner-perl/issues/427 https://github.com/major/MySQLTuner-perl/issues/441 https://github.com/major/MySQLTuner-perl/issues/442 --- mysqltuner.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index fe63f5c..9bd86a0 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -1738,8 +1738,14 @@ sub security_recommendations { my $PASS_COLUMN_NAME = 'password'; if ( $myvar{'version'} =~ /5\.7|10\..*MariaDB*/ ) { - $PASS_COLUMN_NAME = + my $password_column_exists = `$mysqlcmd $mysqllogin -Bse "SELECT 1 FROM information_schema.columns WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'user' AND COLUMN_NAME = 'password'" 2>>/dev/null`; + if ($password_column_exists) { + $PASS_COLUMN_NAME = "IF(plugin='mysql_native_password', authentication_string, password)"; + } + else { + $PASS_COLUMN_NAME = 'authentication_string'; + } } debugprint "Password column = $PASS_COLUMN_NAME";