Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit 16774e3

Browse files
committed
Now we have a new default user, we should save/restore it in testing, to ensure we get the right timestamps etc.
1 parent 08144a0 commit 16774e3

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

mysql-test/suite/sysschema/r/mysqldump.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
CREATE TEMPORARY TABLE tmp_user AS SELECT * FROM mysql.user;
2+
CREATE TEMPORARY TABLE tmp_tables_priv AS SELECT * FROM mysql.tables_priv;
13
DROP DATABASE sys;
24
SHOW DATABASES;
35
Database
@@ -48,3 +50,10 @@ mysql
4850
performance_schema
4951
sys
5052
test
53+
TRUNCATE TABLE mysql.user;
54+
INSERT INTO mysql.user (SELECT * FROM tmp_user);
55+
DROP TEMPORARY TABLE tmp_user;
56+
TRUNCATE TABLE mysql.tables_priv;
57+
INSERT INTO mysql.tables_priv (SELECT * FROM tmp_tables_priv);
58+
DROP TEMPORARY TABLE tmp_tables_priv;
59+
FLUSH PRIVILEGES;

mysql-test/suite/sysschema/t/mysqldump.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# Dump all databases
44
--exec $MYSQL_DUMP -uroot --all-databases > $MYSQLTEST_VARDIR/tmp/bug20902791.sql
55

6+
# Save a copy of the user/tables_priv, to restore later
7+
# Otherwise the final mysql_upgrade will REPLACE and update timestamps etc.
8+
CREATE TEMPORARY TABLE tmp_user AS SELECT * FROM mysql.user;
9+
CREATE TEMPORARY TABLE tmp_tables_priv AS SELECT * FROM mysql.tables_priv;
10+
611
# Remove the sys schema
712
DROP DATABASE sys;
813

@@ -15,3 +20,14 @@ SHOW DATABASES;
1520
# Finally reload the sys schema to return to normal
1621
--exec $MYSQL_UPGRADE --skip-verbose --force
1722
SHOW DATABASES;
23+
24+
# Restore the saved privileges
25+
TRUNCATE TABLE mysql.user;
26+
INSERT INTO mysql.user (SELECT * FROM tmp_user);
27+
DROP TEMPORARY TABLE tmp_user;
28+
29+
TRUNCATE TABLE mysql.tables_priv;
30+
INSERT INTO mysql.tables_priv (SELECT * FROM tmp_tables_priv);
31+
DROP TEMPORARY TABLE tmp_tables_priv;
32+
33+
FLUSH PRIVILEGES;

0 commit comments

Comments
 (0)