Commit df7b27f1 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6984 Can't migrate from MySQL 5.6.21 to MariaDB 10

in mysql_upgrade: do FLUSH PRIVILEGES at the end, not together with
mysql_fix_privilege_tables

mysql-test/t/mysql_upgrade-6984.opt:
  use a dummy second option to force server restart after the test
parent 51d7e803
......@@ -762,7 +762,7 @@ static int run_mysqlcheck_upgrade(const char *arg1, const char *arg2)
static int run_mysqlcheck_fixnames(void)
{
verbose("Phase 3/4: Fixing table and database names");
verbose("Phase 3/5: Fixing table and database names");
print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
......@@ -860,6 +860,7 @@ static int run_sql_fix_privilege_tables(void)
query_ptr++
)
{
if (strcasecmp(*query_ptr, "flush privileges;\n"))
dynstr_append(&ds_script, *query_ptr);
}
......@@ -1021,19 +1022,23 @@ int main(int argc, char **argv)
/*
Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
*/
verbose("Phase 1/4: Checking mysql database");
verbose("Phase 1/5: Checking mysql database");
if (run_mysqlcheck_upgrade("--databases", "mysql"))
die("Upgrade failed" );
verbose("Phase 2/4: Running 'mysql_fix_privilege_tables'...");
verbose("Phase 2/5: Running 'mysql_fix_privilege_tables'...");
if (run_sql_fix_privilege_tables())
die("Upgrade failed" );
if (!opt_systables_only &&
(run_mysqlcheck_fixnames() ||
verbose("Phase 4/4: Checking and upgrading tables") ||
verbose("Phase 4/5: Checking and upgrading tables") ||
run_mysqlcheck_upgrade("--all-databases","--skip-database=mysql")))
die("Upgrade failed" );
verbose("Phase 5/5: Running 'FLUSH PRIVILEGES'...");
if (run_query("FLUSH PRIVILEGES", NULL, TRUE))
die("Upgrade failed" );
verbose("OK");
/* Create a file indicating upgrade has been performed */
......
......@@ -227,7 +227,7 @@ DROP TABLE mysql050614_xxx_croatian_ci;
# Checking mysql_upgrade
#
# Running mysql_upgrade
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -258,9 +258,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -279,10 +279,11 @@ test.maria050313_ucs2_croatian_ci_def OK
test.maria050313_utf8_croatian_ci OK
test.maria050533_xxx_croatian_ci OK
test.maria100004_xxx_croatian_ci OK
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
# Running mysql_upgrade for the second time
# This should report OK for all tables
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -313,9 +314,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -328,6 +329,7 @@ test.maria050313_utf8_croatian_ci OK
test.maria050533_xxx_croatian_ci OK
test.maria100004_xxx_croatian_ci OK
test.mysql050614_xxx_croatian_ci OK
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def;
Table Create Table
......
......@@ -11,7 +11,7 @@ Table Op Msg_type Msg_text
test.bug49823 repair status OK
RENAME TABLE general_log TO renamed_general_log;
RENAME TABLE test.bug49823 TO general_log;
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -43,9 +43,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -53,6 +53,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
DROP TABLE general_log;
RENAME TABLE renamed_general_log TO general_log;
......
update mysql.user set password=password("foo") where user='root';
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stats OK
mysql.innodb_index_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.roles_mapping OK
mysql.servers OK
mysql.table_stats OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Repairing tables
mysql.innodb_index_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
update mysql.user set password='' where user='root';
flush privileges;
Run mysql_upgrade once
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -30,9 +30,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -40,11 +40,12 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
Run it again - should say already completed
This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
Force should run it regardless of wether it's been run before
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -75,9 +76,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -85,11 +86,12 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
GRANT ALL ON *.* TO mysqltest1@'%';
Run mysql_upgrade with password protected account
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -120,9 +122,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -130,6 +132,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
DROP USER mysqltest1@'%';
Version check failed. Got the following error when calling the 'mysql' command line client
......@@ -139,7 +142,7 @@ Run mysql_upgrade with a non existing server socket
mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect
FATAL ERROR: Upgrade failed
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -170,9 +173,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -180,6 +183,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
set GLOBAL sql_mode=default;
#
......@@ -190,7 +194,7 @@ CREATE PROCEDURE testproc() BEGIN END;
UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc';
UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc';
UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc';
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -221,9 +225,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -231,6 +235,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
CALL testproc();
DROP PROCEDURE testproc;
......@@ -244,7 +249,7 @@ WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been
GRANT USAGE ON *.* TO 'user3'@'%';
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
Run mysql_upgrade with all privileges on a user
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -275,9 +280,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -285,6 +290,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
SHOW GRANTS FOR 'user3'@'%';
Grants for user3@%
......@@ -293,7 +299,7 @@ GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'
DROP USER 'user3'@'%';
End of 5.1 tests
The --upgrade-system-tables option was used, user tables won't be touched.
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -324,7 +330,8 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
#
# Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION
......@@ -332,7 +339,7 @@ OK
#
# Droping the previously created mysql_upgrade_info file..
# Running mysql_upgrade with --skip-write-binlog..
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -363,9 +370,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -373,6 +380,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
#
# MDEV-4332 Increase username length from 16 characters
......@@ -386,7 +394,7 @@ GRANT INSERT ON mysql.user TO very_long_user_name_number_2;
GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_1;
GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_2;
CREATE PROCEDURE test.pr() BEGIN END;
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -417,9 +425,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -427,6 +435,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
SELECT definer FROM mysql.proc WHERE db = 'test' AND name = 'pr';
definer
......
The --upgrade-system-tables option was used, user tables won't be touched.
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -42,5 +42,6 @@ error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
#
# Bug#55672 mysql_upgrade dies with internal error
#
Phase 1/4: Checking mysql database
Phase 1/5: Checking mysql database
Processing databases
mysql
mysql.column_stats OK
......@@ -32,9 +32,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/4: Running 'mysql_fix_privilege_tables'...
Phase 3/4: Fixing table and database names
Phase 4/4: Checking and upgrading tables
Phase 2/5: Running 'mysql_fix_privilege_tables'...
Phase 3/5: Fixing table and database names
Phase 4/5: Checking and upgrading tables
Processing databases
information_schema
mtr
......@@ -42,4 +42,5 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 5/5: Running 'FLUSH PRIVILEGES'...
OK
--skip-grant-tables --group-concat-max-len=1023
#
# MDEV-6984 Can't migrate from MySQL 5.6.21 to MariaDB 10
#
--source include/not_embedded.inc
#
# When 'root' account is password protected and MYSQL_UPGRADE doesn't
# know the password (meaning, MYSQL_UPGRADE is run automatically
# on upgrade), MYSQLD has to be started with --skip-grant-tables.
#
# In this setup MYSQL_UPGRADE cannot continue after issuing FLUSH PRIVILEGES
#
update mysql.user set password=password("foo") where user='root';
--exec $MYSQL_UPGRADE
connect(con1,localhost,root,foo,,,);
update mysql.user set password='' where user='root';
flush privileges;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment