Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 12 additions & 29 deletions mysqltuner.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3306,37 +3306,20 @@ sub security_recommendations {

infoprint "$myvar{'version_comment'} - $myvar{'version'}";

my $PASS_COLUMN_NAME = 'password';
my $PASS_COLUMN_NAME;

# New table schema available since mysql-5.7 and mariadb-10.2
# But need to be checked
if (
( $myvar{'version'} =~ /5\.7/ )
or (
( $myvar{'version'} =~ /10\.[2-5]\..*/ )
and ( ( $myvar{'version'} =~ /MariaDB/i )
or ( $myvar{'version_comment'} =~ /MariaDB/i ) )
)
)
{
my $result_pass = execute_system_command(
"$mysqlcmd $mysqllogin -Bse \"SELECT 1 FROM information_schema.columns WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'user' AND COLUMN_NAME = 'password'\" 2>>$devnull"
);
my $result_auth = execute_system_command(
"$mysqlcmd $mysqllogin -Bse \"SELECT 1 FROM information_schema.columns WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'user' AND COLUMN_NAME = 'authentication_string'\" 2>>$devnull"
);
if ( $result_pass && $result_auth ) {
$PASS_COLUMN_NAME =
"IF(plugin='mysql_native_password', authentication_string, password)";
}
elsif ($result_auth) {
$PASS_COLUMN_NAME = 'authentication_string';
}
elsif ( !$result_pass ) {
infoprint "Skipped due to none of known auth columns exists";
return;
}
my @mysql_user_columns = select_table_columns_db( 'mysql', 'user' );
if ( grep { /^authentication_string$/msx } @mysql_user_columns ) {
$PASS_COLUMN_NAME = 'authentication_string';
}
elsif ( grep { /^Password$/msx } @mysql_user_columns ) {
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
$PASS_COLUMN_NAME = 'Password';
}
else {
badprint 'Skipped because could not determine auth column';
return;
}

debugprint "Password column = $PASS_COLUMN_NAME";

# IS THERE A ROLE COLUMN
Expand Down
Loading