Merge pull request #809 from percona/PT-2190_pt-show-grants_should_use_print_identified_with_as_hex

PT-2190 - pt-show-grants should use print_identified_with_as_hex
This commit is contained in:
Sveta Smirnova
2024-05-06 14:45:27 +03:00
committed by GitHub
2 changed files with 79 additions and 1 deletions

View File

@@ -2006,11 +2006,18 @@ sub main {
# Roles can be identified because the user password is expired, the authentication
# string is empty and the account is locked
my $mysql8_where = '';
if ($version !~ "-MariaDB" && VersionCompare::cmp($version, '8.0.0') >= 0) {
if ( $version !~ "-MariaDB" && VersionCompare::cmp($version, '8.0.0') >= 0 ) {
$mysql8_where = ' WHERE NOT ( `account_locked`="Y" AND ' .
' `password_expired`="Y" AND ' .
' `authentication_string`="" ) ';
}
# PT-2190. Starting from 8.0.17 we will set print_identified_with_as_hex
# before getting users
if ( $version !~ "-MariaDB" && VersionCompare::cmp($version, '8.0.17') >= 0 ) {
$dbh->do('SET print_identified_with_as_hex = 1');
}
my $users = $o->get('only') || $dbh->selectall_arrayref(
"SELECT DISTINCT User, Host FROM mysql.user $mysql8_where ORDER BY User, Host",
{ Slice => {} });