1
# Embedded server doesn't support external clients
2
--source include/not_embedded.inc
4
# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
5
# to the location of mysql_fix_privilege_tables.sql
6
if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`)
8
skip Test need MYSQL_FIX_PRIVILEGE_TABLES;
12
# This is the test for mysql_fix_privilege_tables
13
# It checks that a system tables from mysql 4.1.23
14
# can be upgraded to current system table format
16
# Note: If this test fails, don't be confused about the errors reported
17
# by mysql-test-run This shows warnings generated by
18
# mysql_fix_system_tables which should be ignored.
19
# Instead, concentrate on the errors in r/system_mysql_db.reject
22
drop table if exists t1,t1aa,t2aa;
26
# Bug #20589 Missing some table level privileges after upgrade
28
# Add some grants that should survive the "upgrade"
31
DROP DATABASE IF EXISTS testdb;
33
CREATE DATABASE testdb;
34
CREATE TABLE testdb.t1 (
36
c3 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
38
CREATE VIEW testdb.v1 AS
39
SELECT * FROM testdb.t1;
41
GRANT CREATE VIEW, SHOW VIEW ON testdb.v1 TO 'show_view_tbl'@'localhost';
42
SHOW GRANTS FOR 'show_view_tbl'@'localhost';
45
# Some extra GRANTS for more complete test
46
GRANT SELECT(c1) on testdb.v1 to 'select_only_c1'@localhost;
47
SHOW GRANTS FOR 'select_only_c1'@'localhost';
53
# Run the mysql_fix_privilege_tables.sql using "mysql --force"
54
# Determine the number of open sessions
55
--source include/count_sessions.inc
56
--exec $MYSQL --force mysql < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/tmp/fix_priv_tables.log 2>&1
57
--remove_file $MYSQLTEST_VARDIR/tmp/fix_priv_tables.log
58
# Wait till the number of open sessions is <= the number before the run with $MYSQL
59
# = The session caused by mysql has finished its disconnect
60
--source include/wait_until_count_sessions.inc
65
echo "after fix privs";
67
SHOW GRANTS FOR 'show_view_tbl'@'localhost';
69
SHOW GRANTS FOR 'select_only_c1'@'localhost';
72
DROP USER 'show_view_tbl'@'localhost';
73
DROP USER 'select_only_c1'@'localhost';