mysql-server/mysql-test/t/mysql_upgrade.test
2025-03-05 14:31:37 +07:00

127 lines
3.8 KiB
Text

--source include/big_test.inc
--source include/not_valgrind.inc
--let $MYSQLD_DATADIR= `select @@datadir`
--source include/mysql_upgrade_preparation.inc
#
# Bug #28547424 - MYSQL_UPGRADE FAILES WITH SYNTAX ERROR ON INPLACE FROM 5.7 TO 8.0
#
--let $sql_mode_old= `SELECT @@sql_mode`
--let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/mysql_upgrade_test.log
--replace_result $MYSQLD_LOG MYSQLD_LOG
--let $restart_parameters = restart:--upgrade=FORCE --sql-mode=$sql_mode_old,ANSI_QUOTES --log-error=$MYSQLD_LOG
--let $wait_counter= 10000
--source include/restart_mysqld.inc
--echo # There should be no errors
--let SEARCH_FILE= $MYSQLD_LOG
--let SEARCH_PATTERN= \[ERROR\]
--source include/search_pattern.inc
--echo # mysql_upgrade_history file should be created successfully.
--file_exists $MYSQLD_DATADIR/mysql_upgrade_history
--remove_file $MYSQLD_LOG
--echo # Restart server with defaults
--let $restart_parameters = restart:
--source include/restart_mysqld.inc
--echo #
--echo # Bug #27549249: MYSQL_UPGRADE FAILED TO CHANGE @@SESSION.SQL_LOG_BIN
--echo # WHEN AUTOCOMMIT IS OFF
--echo #
# Filter out ndb_binlog_index to mask differences due to running with or
# without ndb.
--let $restart_parameters = restart:--upgrade=FORCE --autocommit=0
--let $wait_counter= 10000
--source include/restart_mysqld.inc
--echo # Restart server with defaults
--let $restart_parameters = restart:
--source include/restart_mysqld.inc
--echo #
--echo # Bug #28392985: SESSION USER DOES NOT HAVE PRIV SESSION_VARIABLES_ADMIN IN UPGRADED DATABASE
--echo #
SHOW GRANTS FOR "mysql.session"@localhost;
REVOKE SESSION_VARIABLES_ADMIN ON *.* FROM "mysql.session"@localhost;
# Filter out ndb_binlog_index to mask differences due to running with or
# without ndb.
--let $restart_parameters = restart:--upgrade=FORCE
--let $wait_counter= 10000
--source include/restart_mysqld.inc
--echo # Must have SESSION_VARIABLES_ADMIN;
SHOW GRANTS FOR "mysql.session"@localhost;
--echo #
--echo # Bug #28855207: 8.0.13 - MYSQL_UPGRADE FAILS DUE TO PRIMARY KEY ERROR WITHOUT STATING THE TABLE
--echo #
--let restart_parameters=restart: --sql_require_primary_key=1 --upgrade=FORCE
--let $wait_counter= 10000
--source include/restart_mysqld.inc
--echo #
--echo # Bug #33165861: WL#14183 new privileges not taken into account for upgrades
--echo #
CREATE USER u1,u2;
GRANT CREATE USER ON *.* TO u1;
GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO u2;
--echo # There should be no PASSWORDLESS_USER_ADMIN privilege
SHOW GRANTS FOR u1;
--echo # There should be no AUTHENTICATION_POLICY_ADMIN privilege
SHOW GRANTS FOR u2;
# remove these privielges
REVOKE PASSWORDLESS_USER_ADMIN, AUTHENTICATION_POLICY_ADMIN ON *.* FROM root@localhost;
--let $restart_parameters = restart:--upgrade=FORCE
--let $wait_counter= 10000
--source include/restart_mysqld.inc
--echo # Must have PASSWORDLESS_USER_ADMIN privilege
SHOW GRANTS FOR u1;
--echo # Must have AUTHENTICATION_POLICY_ADMIN privilege
SHOW GRANTS FOR u2;
--echo # Must have AUTHENTICATION_POLICY_ADMIN, PASSWORDLESS_USER_ADMIN privilegea
--let $user = root@localhost
--source include/show_grants.inc
# Cleanup
DROP USER u1,u2;
--echo #
--echo # Bug#34068378: Grant SENSITIVE_VARIABLES_OBSERVER in case of database upgrade
--echo #
CREATE USER u34068378;
GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO u34068378;
--echo # There should be no SENSITIVE_VARIABLES_OBSERVER privilege
SHOW GRANTS for u34068378;
# remove SENSITIVE_VARIABLES_OBSERVER from root
REVOKE SENSITIVE_VARIABLES_OBSERVER ON *.* FROM root@localhost;
--let $restart_parameters = restart:--upgrade=FORCE
--let $wait_counter= 10000
--source include/restart_mysqld.inc
--echo # Must have SENSITIVE_VARIABLES_OBSERVER privilege
SHOW GRANTS for u34068378;
--let $user = root@localhost
--source include/show_grants.inc
# cleanup
DROP USER u34068378;
--echo
--echo End of tests