Skip to content

Commit 066acb0

Browse files
authored
Update mysqltuner.pl
Check to make sure mysql.user has a column called 'password'. Adjust security_recommendations queries accordingly. This should address issues: major#427 major#441 major#442
1 parent 8206205 commit 066acb0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: mysqltuner.pl

+7-1
Original file line numberDiff line numberDiff line change
@@ -1738,8 +1738,14 @@ sub security_recommendations {
17381738

17391739
my $PASS_COLUMN_NAME = 'password';
17401740
if ( $myvar{'version'} =~ /5\.7|10\..*MariaDB*/ ) {
1741-
$PASS_COLUMN_NAME =
1741+
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`;
1742+
if ($password_column_exists) {
1743+
$PASS_COLUMN_NAME =
17421744
"IF(plugin='mysql_native_password', authentication_string, password)";
1745+
}
1746+
else {
1747+
$PASS_COLUMN_NAME = 'authentication_string';
1748+
}
17431749
}
17441750
debugprint "Password column = $PASS_COLUMN_NAME";
17451751

0 commit comments

Comments
 (0)