mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:30:16 +00:00
PT-1563 Fixed pt-show-grants for MySQL 5.6
Also updated tests for MySQL 8.0+
This commit is contained in:
@@ -1912,11 +1912,14 @@ sub main {
|
||||
# MySQL 8 roles must be excluded from the regular users list.
|
||||
# Roles can be identified because the user password is expired, the authentication
|
||||
# string is empty and the account is locked
|
||||
my $mysql8_where = '';
|
||||
if (VersionCompare::cmp($version, '8.0.0') >= 0) {
|
||||
$mysql8_where = ' WHERE NOT ( `account_locked`="Y" AND ' .
|
||||
' `password_expired`="Y" AND ' .
|
||||
' `authentication_string`="" ) ';
|
||||
}
|
||||
my $users = $o->get('only') || $dbh->selectall_arrayref(
|
||||
'SELECT DISTINCT User, Host FROM mysql.user WHERE NOT (`account_locked`="Y"
|
||||
AND `password_expired`="Y"
|
||||
AND `authentication_string`=""
|
||||
) ORDER BY User, Host',
|
||||
"SELECT DISTINCT User, Host FROM mysql.user $mysql8_where ORDER BY User, Host",
|
||||
{ Slice => {} });
|
||||
if ( scalar @all_hosts ) {
|
||||
my $where = join(' OR ', map { "User='$_'" } @all_hosts);
|
||||
|
Reference in New Issue
Block a user