|
1 | 1 | /* |
2 | | - Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. |
| 2 | + Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. |
3 | 3 |
|
4 | 4 | This program is free software; you can redistribute it and/or modify |
5 | 5 | it under the terms of the GNU General Public License as published by |
@@ -763,7 +763,7 @@ static int run_mysqlcheck_mysql_db_upgrade(void) |
763 | 763 | } |
764 | 764 |
|
765 | 765 |
|
766 | | -/** performs the same operation as mysqlcheck_upgrade, but on the mysql db */ |
| 766 | +/** performs the same operation as mysqlcheck_fixnames, but on the mysql db */ |
767 | 767 | static int run_mysqlcheck_mysql_db_fixnames(void) |
768 | 768 | { |
769 | 769 | print_conn_args("mysqlcheck"); |
@@ -929,10 +929,16 @@ static int check_version_match(void) |
929 | 929 | if (init_dynamic_string(&ds_version, NULL, NAME_CHAR_LEN, NAME_CHAR_LEN)) |
930 | 930 | die("Out of memory"); |
931 | 931 |
|
932 | | - if (run_query("show variables like 'version'", |
933 | | - &ds_version, FALSE) || |
934 | | - extract_variable_from_show(&ds_version, version_str)) |
| 932 | + if (run_query("show variables like 'version'", &ds_version, FALSE)) |
| 933 | + { |
| 934 | + fprintf(stderr, "Error: Failed while fetching Server version! Could be" |
| 935 | + " due to unauthorized access.\n"); |
| 936 | + dynstr_free(&ds_version); |
| 937 | + return 1; /* Query failed */ |
| 938 | + } |
| 939 | + if (extract_variable_from_show(&ds_version, version_str)) |
935 | 940 | { |
| 941 | + fprintf(stderr, "Error: Failed while extracting Server version!\n"); |
936 | 942 | dynstr_free(&ds_version); |
937 | 943 | return 1; /* Query failed */ |
938 | 944 | } |
@@ -1027,17 +1033,37 @@ int main(int argc, char **argv) |
1027 | 1033 | Then do the upgrade. |
1028 | 1034 | And then run mysqlcheck on all tables. |
1029 | 1035 | */ |
1030 | | - if ((!opt_systables_only && |
1031 | | - (run_mysqlcheck_mysql_db_fixnames() || run_mysqlcheck_mysql_db_upgrade())) || |
1032 | | - run_sql_fix_privilege_tables() || |
1033 | | - (!opt_systables_only && |
1034 | | - (run_mysqlcheck_fixnames() || run_mysqlcheck_upgrade()))) |
| 1036 | + if (!opt_systables_only) |
1035 | 1037 | { |
1036 | | - /* |
1037 | | - The upgrade failed to complete in some way or another, |
1038 | | - significant error message should have been printed to the screen |
1039 | | - */ |
1040 | | - die("Upgrade failed" ); |
| 1038 | + if (run_mysqlcheck_mysql_db_fixnames()) |
| 1039 | + { |
| 1040 | + die("Error during call to mysql_check for fixing the db/tables names on " |
| 1041 | + "mysql db"); |
| 1042 | + } |
| 1043 | + if (run_mysqlcheck_mysql_db_upgrade()) |
| 1044 | + { |
| 1045 | + die("Error during call to mysql_check for upgrading the tables names on " |
| 1046 | + "mysql db"); |
| 1047 | + } |
| 1048 | + } |
| 1049 | + if (run_sql_fix_privilege_tables()) |
| 1050 | + { |
| 1051 | + /* Specific error msg (if present) would be printed in the function call |
| 1052 | + * above */ |
| 1053 | + die("Upgrade failed"); |
| 1054 | + } |
| 1055 | + if (!opt_systables_only) |
| 1056 | + { |
| 1057 | + if (run_mysqlcheck_fixnames()) |
| 1058 | + { |
| 1059 | + die("Error during call to mysql_check for fixing the db/tables names on " |
| 1060 | + "all db(s) except mysql"); |
| 1061 | + } |
| 1062 | + if (run_mysqlcheck_upgrade()) |
| 1063 | + { |
| 1064 | + die("Error during call to mysql_check for upgrading the tables names on " |
| 1065 | + "all db(s) except mysql"); |
| 1066 | + } |
1041 | 1067 | } |
1042 | 1068 | verbose("OK"); |
1043 | 1069 |
|
|
0 commit comments