This repository was archived by the owner on Aug 28, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
mysql-test/suite/sysschema Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ CREATE TEMPORARY TABLE tmp_user AS SELECT * FROM mysql.user;
2+ CREATE TEMPORARY TABLE tmp_tables_priv AS SELECT * FROM mysql.tables_priv;
13DROP DATABASE sys;
24SHOW DATABASES;
35Database
4850performance_schema
4951sys
5052test
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;
Original file line number Diff line number Diff line change 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
712DROP 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
1722SHOW 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;
You can’t perform that action at this time.
0 commit comments