summaryrefslogtreecommitdiff
path: root/mysql-test/main/grant.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/grant.test')
-rw-r--r--mysql-test/main/grant.test55
1 files changed, 30 insertions, 25 deletions
diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test
index 2b8d7337ceb..47a274d75d1 100644
--- a/mysql-test/main/grant.test
+++ b/mysql-test/main/grant.test
@@ -10,6 +10,7 @@ set GLOBAL sql_mode="";
set LOCAL sql_mode="";
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
# Cleanup
--disable_warnings
@@ -131,7 +132,7 @@ select 1; # To test that the previous command didn't cause problems
#
# Bug#4898 User privileges depending on ORDER BY Settings of table db
#
-insert into mysql.user (host, user) values ('localhost', 'test11');
+insert into mysql.global_priv (host, user) values ('localhost', 'test11');
insert into mysql.db (host, db, user, select_priv) values
('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
alter table mysql.db order by db asc;
@@ -581,12 +582,6 @@ drop database db27515;
use test;
create table t1 (a int);
-# Backup anonymous users and remove them. (They get in the way of
-# the one we test with here otherwise.)
-create table t2 as select * from mysql.user where user='';
-delete from mysql.user where user='';
-flush privileges;
-
# Create some users with different hostnames
create user mysqltest_8@'';
create user mysqltest_8@host8;
@@ -700,10 +695,6 @@ drop user mysqltest_8@host8;
--error ER_NONEXISTING_GRANT
show grants for mysqltest_8@host8;
-# Restore the anonymous users.
-insert into mysql.user select * from t2;
-flush privileges;
-drop table t2;
drop table t1;
#
@@ -1265,9 +1256,6 @@ SELECT CURRENT_USER();
SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
-#cleanup after MDEV-16238
-update mysql.user set plugin='';
-
#
# Bug#57952: privilege change is not taken into account by EXECUTE.
#
@@ -2233,7 +2221,7 @@ set GLOBAL sql_mode=default;
--source include/wait_until_count_sessions.inc
--echo #
---echo # Start of 10.2 tests
+--echo # End of 10.1 tests
--echo #
--echo #
@@ -2270,11 +2258,7 @@ DROP USER dummy@localhost;
# Let's cheat server that we are using `10.2` user table
# which doesn't have `Delete_history_priv` column
-SET @had_user_delete_history_priv := 0;
-SELECT @had_user_delete_history_priv :=1 FROM mysql.user WHERE Delete_history_priv LIKE '%';
-
-ALTER TABLE mysql.user DROP COLUMN Delete_history_priv;
-FLUSH PRIVILEGES;
+source include/switch_to_mysql_user.inc;
CREATE USER ten2;
GRANT ALL ON *.* TO ten2;
@@ -2286,12 +2270,33 @@ FLUSH PRIVILEGES;
# Now should show `all privileges` with/without patch
SHOW GRANTS FOR ten2;
DROP USER ten2;
-
-# Restore original table (similar to `mysql_upgrade`)
-ALTER TABLE mysql.user ADD Delete_history_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N' after Create_tablespace_priv;
-UPDATE mysql.user SET Delete_history_priv = Super_priv WHERE @had_user_delete_history_priv = 1;
-FLUSH PRIVILEGES;
+source include/switch_to_mysql_global_priv.inc;
--echo #
--echo # End of 10.3 tests
--echo #
+
+--echo #
+--echo # MDEV-17932 : Assertion upon double RENAME USER
+--echo #
+CREATE USER foo@localhost;
+CREATE USER bar2@localhost;
+RENAME USER foo@localhost TO bar1@localhost, bar1@localhost TO bar3@localhost;
+DROP USER bar2@localhost;
+DROP USER bar3@localhost;
+
+--echo #
+--echo # MDEV-17946 : Unsorted acl_dbs after RENAME USER
+--echo #
+CREATE USER foo;
+GRANT SELECT ON test.* TO foo;
+RENAME USER '' TO 'name';
+GRANT UPDATE ON test.* TO foo;
+RENAME USER 'name' to '';
+DROP USER foo;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
+
+update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';