mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 02:34:19 +00:00
PT-1563 Fixed pt-show-grants for MySQL 5.6
Also updated tests for MySQL 8.0+
This commit is contained in:
@@ -38,9 +38,11 @@ my $cnf = '/tmp/12345/my.sandbox.cnf';
|
||||
# user (over multiple hosts)
|
||||
# #############################################################################
|
||||
|
||||
# to make creating users easier we remove NO_AUTO_CREATE_USER mode
|
||||
my $modes = new SqlModes($dbh, global=>1);
|
||||
$modes->del('NO_AUTO_CREATE_USER');
|
||||
diag(`/tmp/12345/use -u root -e "CREATE USER 'bob'\@'%'"`);
|
||||
diag(`/tmp/12345/use -u root -e "CREATE USER 'bob'\@'localhost'"`);
|
||||
diag(`/tmp/12345/use -u root -e "CREATE USER 'bob'\@'192.168.1.1'"`);
|
||||
|
||||
diag(`/tmp/12345/use -u root -e "GRANT USAGE ON *.* TO 'bob'\@'%'"`);
|
||||
diag(`/tmp/12345/use -u root -e "GRANT USAGE ON *.* TO 'bob'\@'localhost'"`);
|
||||
diag(`/tmp/12345/use -u root -e "GRANT USAGE ON *.* TO 'bob'\@'192.168.1.1'"`);
|
||||
|
@@ -83,7 +83,7 @@ unlike(
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { pt_show_grants::main('-F', $cnf, '--ignore', 'baron,msandbox,root,root@localhost,user,mysql.session@localhost,mysql.sys@localhost,sys'); }
|
||||
sub { pt_show_grants::main('-F', $cnf, '--ignore', 'baron,msandbox,root,root@localhost,user,mysql.session@localhost,mysql.sys@localhost,sys,mysql.infoschema@localhost'); }
|
||||
);
|
||||
unlike(
|
||||
$output,
|
||||
@@ -100,12 +100,9 @@ like(
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/866075
|
||||
# #############################################################################
|
||||
$sb->load_file('master', 't/pt-show-grants/samples/column-grants.sql');
|
||||
# momentarily disable NO_AUTO_CREATE_USER
|
||||
my $modes = new SqlModes($dbh, global=>1);
|
||||
$modes->del('NO_AUTO_CREATE_USER');
|
||||
diag(`/tmp/12345/use -u root -e "CREATE USER 'sally'\@'%'"`);
|
||||
diag(`/tmp/12345/use -u root -e "GRANT SELECT(DateCreated, PckPrice, PaymentStat, SANumber) ON test.t TO 'sally'\@'%'"`);
|
||||
diag(`/tmp/12345/use -u root -e "GRANT SELECT(city_id), INSERT(city) ON sakila.city TO 'sally'\@'%'"`);
|
||||
$modes->restore_original_modes();
|
||||
|
||||
my $postfix = $sandbox_version >= '8.0' ? '-80' : $sandbox_version < '5.7' ? '' : '-57';
|
||||
|
||||
|
@@ -37,10 +37,8 @@ my $cnf = '/tmp/12345/my.sandbox.cnf';
|
||||
# #############################################################################
|
||||
|
||||
# allow auto create user for a moment
|
||||
my $modes = new SqlModes($dbh, global=>1);
|
||||
$modes->del('NO_AUTO_CREATE_USER');
|
||||
diag(`/tmp/12345/use -u root -e "CREATE USER ''\@''"`);
|
||||
diag(`/tmp/12345/use -u root -e "GRANT USAGE ON *.* TO ''\@''"`);
|
||||
$modes->restore_original_modes();
|
||||
|
||||
$output = `/tmp/12345/use -e "SELECT user FROM mysql.user WHERE user = ''"`;
|
||||
like(
|
||||
|
@@ -6,7 +6,7 @@ CREATE TABLE t (
|
||||
`SOrNum` mediumint(9) unsigned NOT NULL auto_increment,
|
||||
`SPNum` mediumint(9) unsigned NOT NULL,
|
||||
`DateCreated` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
||||
`DateRelease` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
||||
`DateRelease` timestamp NOT NULL,
|
||||
`ActualReleasedDate` timestamp NULL default NULL,
|
||||
`PckPrice` decimal(10,2) NOT NULL default '0.00',
|
||||
`Status` varchar(20) NOT NULL,
|
||||
|
Reference in New Issue
Block a user