[MDEV-24453] mysql_upgrade does not honor --verbose parameter Created: 2020-12-20  Updated: 2023-03-27  Resolved: 2023-03-27

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Fix Version/s: 10.4.29, 10.5.20

Type: Task Priority: Major
Reporter: naox Assignee: Anel Husakovic
Resolution: Fixed Votes: 0
Labels: beginner-friendly


 Description   

It would be nice if mysql_upgrade would honor --verbose parameter and pass it to called mysql command (during privileges table upgrade). Without it its very hard to debug anything.



 Comments   
Comment by Shubham Kumar [ 2021-02-05 ]

I'm new to MariaDB. Can I contribute to this issue?

Comment by Sayan Mukherjee [ 2021-02-07 ]

I'm familiar with MySQL upgrades.
As of MySQL 5.7.12, the default --early-plugin-load value is empty. To load the keyring_file plugin, you must use an explicit --early-plugin-load option with a nonempty value.

So now I want to fix https://jira.mariadb.org/browse/MDEV-24453 .

Comment by Daniel Black [ 2021-02-07 ]

kalbhairab, Hi, thanks for your interest in this issue. imskr has already start work on this. As another mysql_upgrade related task that isn't being worked maybe consider MDEV-23962, or MDEV-24555, or MDEV-22477. If none of these interest you feel free to pop by on Zulip and talk about other issues that may interest you.

Comment by Sayan Mukherjee [ 2021-02-07 ]

@Daniel Black thank you for your reply.
I'm interested in https://jira.mariadb.org/browse/MDEV-23962 and want to contribute. I've already commented on that.
Please guide me if anything more I need to do, cause I'm totally new to Open Source Contribution.

Comment by Shubham Kumar [ 2021-02-16 ]

what is the fix version?

Comment by Daniel Black [ 2021-02-16 ]

Looking at the current implementation there is a 3 --verbose option. If you add the new functionality under a 4 x --verbose then it remains compatible enough to add to 10.2.

Comment by Shubham Kumar [ 2021-02-23 ]

@Daniel Black do I have to add here I see other functions having --verbose options?

Comment by Daniel Black [ 2021-02-24 ]

Nope. Its to the mysql command so about here but include the same form (since we're up to 4x --verbose):

opt_verbose >= 4 ? "--verbose" : ""

Please also update the man page - man/mysql_upgrade.1

Comment by Shubham Kumar [ 2021-02-24 ]

Okay Thank You @Daniel Black

Comment by Shubham Kumar [ 2021-02-24 ]

I've created the PR. Please review https://github.com/MariaDB/server/pull/1759

Comment by Daniel Black [ 2021-02-25 ]

Apparently looking at the man page there is a 4x option already so moving to 5 is needed. The man page should say what the 5x option is, rather than "added support".

The output generated on a 10.1 data directory is:

~/repos/build-mariadb-server-10.2 
$ client/mysql_upgrade  --no-defaults --verbose --verbose --verbose --verbose -S /tmp/build-mariadb-server-10.2.sock  -u root 
Looking for 'mysql' as: client/mysql
'client/mysql' --no-defaults --help 2>&1 > /dev/null 
Looking for 'mysqlcheck' as: client/mysqlcheck
'client/mysqlcheck' --no-defaults --help 2>&1 > /dev/null 
'client/mysql' --defaults-file=/tmp/mysql_upgrade-aT83xv --database=mysql --batch --verbose --skip-force --silent < /tmp/sqldPL2Ss 2>&1 
'client/mysql' --defaults-file=/tmp/mysql_upgrade-aT83xv --database=mysql --batch --verbose --skip-force --silent < /tmp/sqlK8O8Ps 2>&1 
'client/mysql' --defaults-file=/tmp/mysql_upgrade-aT83xv --database=mysql --batch --verbose --skip-force --silent < /tmp/sqllU1tys 2>&1 
Phase 1/7: Checking and upgrading mysql database
Running 'mysqlcheck' with connection arguments: --socket='/tmp/build-mariadb-server-10.2.sock' 
'client/mysqlcheck' --defaults-file=/tmp/mysql_upgrade-aT83xv --check-upgrade --auto-repair --verbose --verbose --verbose  --skip-write-binlog --databases mysql 2>&1 
# Connecting to localhost...
# Disconnecting from localhost...
Processing databases
mysql
CHECK TABLE `column_stats`  FOR UPGRADE
mysql.column_stats                                 OK
CHECK TABLE `columns_priv`  FOR UPGRADE
mysql.columns_priv                                 OK
CHECK TABLE `db`  FOR UPGRADE
mysql.db                                           OK
CHECK TABLE `event`  FOR UPGRADE
mysql.event                                        OK
CHECK TABLE `func`  FOR UPGRADE
mysql.func                                         OK
CHECK TABLE `gtid_slave_pos`  FOR UPGRADE
mysql.gtid_slave_pos                               OK
CHECK TABLE `help_category`  FOR UPGRADE
mysql.help_category                                OK
CHECK TABLE `help_keyword`  FOR UPGRADE
mysql.help_keyword                                 OK
CHECK TABLE `help_relation`  FOR UPGRADE
mysql.help_relation                                OK
CHECK TABLE `help_topic`  FOR UPGRADE
mysql.help_topic                                   OK
CHECK TABLE `host`  FOR UPGRADE
mysql.host                                         OK
CHECK TABLE `index_stats`  FOR UPGRADE
mysql.index_stats                                  OK
CHECK TABLE `innodb_index_stats`  FOR UPGRADE
mysql.innodb_index_stats                           OK
CHECK TABLE `innodb_table_stats`  FOR UPGRADE
mysql.innodb_table_stats                           OK
CHECK TABLE `plugin`  FOR UPGRADE
mysql.plugin                                       OK
CHECK TABLE `proc`  FOR UPGRADE
mysql.proc                                         OK
CHECK TABLE `procs_priv`  FOR UPGRADE
mysql.procs_priv                                   OK
CHECK TABLE `proxies_priv`  FOR UPGRADE
mysql.proxies_priv                                 OK
CHECK TABLE `roles_mapping`  FOR UPGRADE
mysql.roles_mapping                                OK
CHECK TABLE `servers`  FOR UPGRADE
mysql.servers                                      OK
CHECK TABLE `table_stats`  FOR UPGRADE
mysql.table_stats                                  OK
CHECK TABLE `tables_priv`  FOR UPGRADE
mysql.tables_priv                                  OK
CHECK TABLE `time_zone`  FOR UPGRADE
mysql.time_zone                                    OK
CHECK TABLE `time_zone_leap_second`  FOR UPGRADE
mysql.time_zone_leap_second                        OK
CHECK TABLE `time_zone_name`  FOR UPGRADE
mysql.time_zone_name                               OK
CHECK TABLE `time_zone_transition`  FOR UPGRADE
mysql.time_zone_transition                         OK
CHECK TABLE `time_zone_transition_type`  FOR UPGRADE
mysql.time_zone_transition_type                    OK
CHECK TABLE `user`  FOR UPGRADE
mysql.user                                         OK
'client/mysql' --defaults-file=/tmp/mysql_upgrade-aT83xv --database=mysql --batch --verbose --skip-force --silent < /tmp/sqlk3lZit 2>&1 
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
Running 'mysqlcheck' with connection arguments: --socket='/tmp/build-mariadb-server-10.2.sock' 
'client/mysqlcheck' --defaults-file=/tmp/mysql_upgrade-aT83xv --all-databases --repair --process-views=YES --skip-process-tables --verbose  --skip-write-binlog 2>&1 
Processing databases
information_schema
mysql
performance_schema
test
Phase 4/7: Running 'mysql_fix_privilege_tables'
'client/mysql' --defaults-file=/tmp/mysql_upgrade-aT83xv --database=mysql --batch --verbose --force --silent < /tmp/sql9fqT3s 2>&1 
Phase 5/7: Fixing table and database names
Running 'mysqlcheck' with connection arguments: --socket='/tmp/build-mariadb-server-10.2.sock' 
'client/mysqlcheck' --defaults-file=/tmp/mysql_upgrade-aT83xv --all-databases --fix-db-names --fix-table-names --verbose --verbose --verbose  --skip-write-binlog 2>&1 
# Connecting to localhost...
# Disconnecting from localhost...
Processing databases
information_schema
mysql
performance_schema
test
Phase 6/7: Checking and upgrading tables
Running 'mysqlcheck' with connection arguments: --socket='/tmp/build-mariadb-server-10.2.sock' 
'client/mysqlcheck' --defaults-file=/tmp/mysql_upgrade-aT83xv --check-upgrade --auto-repair --verbose --verbose --verbose  --skip-write-binlog --all-databases --skip-database=mysql 2>&1 
# Connecting to localhost...
# Disconnecting from localhost...
Processing databases
information_schema
performance_schema
test
'client/mysql' --defaults-file=/tmp/mysql_upgrade-aT83xv --database=mysql --batch --verbose --force --silent < /tmp/sqlL2z2cs 2>&1 
'client/mysql' --defaults-file=/tmp/mysql_upgrade-aT83xv --database=mysql --batch --verbose --force --silent < /tmp/sqlAVHOsu 2>&1 
Phase 7/7: Running 'FLUSH PRIVILEGES'
'client/mysql' --defaults-file=/tmp/mysql_upgrade-aT83xv --database=mysql --batch --verbose --force  < /tmp/sqlZIbM9s 2>&1 
--------------
SET SQL_LOG_BIN=0, WSREP_ON=OFF
--------------
 
--------------
FLUSH PRIVILEGES
--------------
 
OK
'client/mysql' --defaults-file=/tmp/mysql_upgrade-aT83xv --database=mysql --batch --verbose --skip-force --silent < /tmp/sqlpbq1Or 2>&1 
'client/mysql' --defaults-file=/tmp/mysql_upgrade-aT83xv --database=mysql --batch --verbose --skip-force --silent < /tmp/sqlRXeCTs 2>&1 

I suspect our bug reporters/watchers want to see the SQL and results from `mysql_fix_privilege_tables`. Can you see what can do that?

Comment by Shubham Kumar [ 2021-02-25 ]

Yeah, I'm looking into it. Thanks

Comment by Shubham Kumar [ 2021-03-01 ]

I'm unable to figure out how to get results from `mysql_fix_privilege_tables`

Comment by Debjyoti Ghosh [ 2023-03-05 ]

Running the mysql_upgrade command to display the fix_privilege_table queries throws all sorts of errors as shown below,
also its a long list of results, maybe better to log them in a file, not sure if its already doing that.

Also, I would like to know whay a 5th --verbose is required to implement this change, as run_mysqlcheck_views shows all the details even without --verbose mentioned (i ran it) when running client/mysql_upgrade command.
(doesn't print only the connection arguments if --verbose not used even once).

Am i missing something?

debjyoti@d3viL3cho:~/original-server/build-10.6$ client/mysql_upgrade  --no-defaults --verbose --verbose --force --datadir=~/original-server/mariadb-datadir-branch/10.4 --verbose --verbose  -S /tmp/mysql.sock  -u debjyoti
client/mysql_upgrade: the '--datadir' option is always ignored
Looking for 'mariadb' as: client/mariadb
'client/mariadb' --no-defaults --help 2>&1 > /dev/null
'client/mariadb' --defaults-file=/tmp/mysql_upgrade-YpwsaW --database=mysql --batch --skip-force --silent < /tmp/sqldq9Afg 2>&1
Looking for 'mariadb-check' as: client/mariadb-check
'client/mariadb-check' --no-defaults --help 2>&1 > /dev/null
'client/mariadb' --defaults-file=/tmp/mysql_upgrade-YpwsaW --database=mysql --batch --skip-force --silent < /tmp/sqlc5qJ3y 2>&1
'client/mariadb' --defaults-file=/tmp/mysql_upgrade-YpwsaW --database=mysql --batch --skip-force --silent < /tmp/sqlk3Rzrd 2>&1
Phase 1/7: Checking and upgrading mysql database
Running 'mariadb-check' with connection arguments: --socket='/tmp/mysql.sock'
'client/mariadb-check' --defaults-file=/tmp/mysql_upgrade-YpwsaW --check-upgrade --auto-repair --verbose --verbose --verbose  --skip-write-binlog --databases mysql 2>&1
# Connecting to localhost...
# Disconnecting from localhost...
Processing databases
mysql
CHECK TABLE `column_stats`  FOR UPGRADE
mysql.column_stats                                 OK
CHECK TABLE `columns_priv`  FOR UPGRADE
mysql.columns_priv                                 OK
CHECK TABLE `db`  FOR UPGRADE
mysql.db                                           OK
CHECK TABLE `event`  FOR UPGRADE
mysql.event                                        OK
CHECK TABLE `func`  FOR UPGRADE
mysql.func                                         OK
CHECK TABLE `global_priv`  FOR UPGRADE
mysql.global_priv                                  OK
CHECK TABLE `gtid_slave_pos`  FOR UPGRADE
mysql.gtid_slave_pos                               OK
CHECK TABLE `help_category`  FOR UPGRADE
mysql.help_category                                OK
CHECK TABLE `help_keyword`  FOR UPGRADE
mysql.help_keyword                                 OK
CHECK TABLE `help_relation`  FOR UPGRADE
mysql.help_relation                                OK
CHECK TABLE `help_topic`  FOR UPGRADE
mysql.help_topic                                   OK
CHECK TABLE `index_stats`  FOR UPGRADE
mysql.index_stats                                  OK
CHECK TABLE `innodb_index_stats`  FOR UPGRADE
mysql.innodb_index_stats                           OK
CHECK TABLE `innodb_table_stats`  FOR UPGRADE
mysql.innodb_table_stats                           OK
CHECK TABLE `plugin`  FOR UPGRADE
mysql.plugin                                       OK
CHECK TABLE `proc`  FOR UPGRADE
mysql.proc                                         OK
CHECK TABLE `procs_priv`  FOR UPGRADE
mysql.procs_priv                                   OK
CHECK TABLE `proxies_priv`  FOR UPGRADE
mysql.proxies_priv                                 OK
CHECK TABLE `roles_mapping`  FOR UPGRADE
mysql.roles_mapping                                OK
CHECK TABLE `servers`  FOR UPGRADE
mysql.servers                                      OK
CHECK TABLE `table_stats`  FOR UPGRADE
mysql.table_stats                                  OK
CHECK TABLE `tables_priv`  FOR UPGRADE
mysql.tables_priv                                  OK
CHECK TABLE `time_zone`  FOR UPGRADE
mysql.time_zone                                    OK
CHECK TABLE `time_zone_leap_second`  FOR UPGRADE
mysql.time_zone_leap_second                        OK
CHECK TABLE `time_zone_name`  FOR UPGRADE
mysql.time_zone_name                               OK
CHECK TABLE `time_zone_transition`  FOR UPGRADE
mysql.time_zone_transition                         OK
CHECK TABLE `time_zone_transition_type`  FOR UPGRADE
mysql.time_zone_transition_type                    OK
CHECK TABLE `transaction_registry`  FOR UPGRADE
mysql.transaction_registry                         OK
'client/mariadb' --defaults-file=/tmp/mysql_upgrade-YpwsaW --database=mysql --batch --skip-force --silent < /tmp/sqlRjKGWZ 2>&1
Phase 2/7: Installing used storage engines... Skipped
'client/mariadb' --defaults-file=/tmp/mysql_upgrade-YpwsaW --database=mysql --batch --force --silent < /tmp/sqlCz2meJ 2>&1
Phase 3/7: Fixing views
Running 'mysqlcheck' with connection arguments: --socket='/tmp/mysql.sock'
'client/mariadb-check' --defaults-file=/tmp/mysql_upgrade-YpwsaW --all-databases --repair --process-views=YES --skip-process-tables --verbose  --skip-write-binlog 2>&1
Processing databases
information_schema
mysql
mysql.user                                         OK
performance_schema
sys
sys.host_summary                                   OK
sys.host_summary_by_file_io                        OK
sys.host_summary_by_file_io_type                   OK
sys.host_summary_by_stages                         OK
sys.host_summary_by_statement_latency              OK
sys.host_summary_by_statement_type                 OK
sys.innodb_buffer_stats_by_schema                  OK
sys.innodb_buffer_stats_by_table                   OK
sys.innodb_lock_waits                              OK
sys.io_by_thread_by_latency                        OK
sys.io_global_by_file_by_bytes                     OK
sys.io_global_by_file_by_latency                   OK
sys.io_global_by_wait_by_bytes                     OK
sys.io_global_by_wait_by_latency                   OK
sys.latest_file_io                                 OK
sys.memory_by_host_by_current_bytes                OK
sys.memory_by_thread_by_current_bytes              OK
sys.memory_by_user_by_current_bytes                OK
sys.memory_global_by_current_bytes                 OK
sys.memory_global_total                            OK
sys.metrics                                        OK
sys.processlist                                    OK
sys.ps_check_lost_instrumentation                  OK
sys.schema_auto_increment_columns                  OK
sys.schema_index_statistics                        OK
sys.schema_object_overview                         OK
sys.schema_redundant_indexes                       OK
sys.schema_table_lock_waits                        OK
sys.schema_table_statistics                        OK
sys.schema_table_statistics_with_buffer            OK
sys.schema_tables_with_full_table_scans            OK
sys.schema_unused_indexes                          OK
sys.session                                        OK
sys.session_ssl_status                             OK
sys.statement_analysis                             OK
sys.statements_with_errors_or_warnings             OK
sys.statements_with_full_table_scans               OK
sys.statements_with_runtimes_in_95th_percentile    OK
sys.statements_with_sorting                        OK
sys.statements_with_temp_tables                    OK
sys.user_summary                                   OK
sys.user_summary_by_file_io                        OK
sys.user_summary_by_file_io_type                   OK
sys.user_summary_by_stages                         OK
sys.user_summary_by_statement_latency              OK
sys.user_summary_by_statement_type                 OK
sys.version                                        OK
sys.wait_classes_global_by_avg_latency             OK
sys.wait_classes_global_by_latency                 OK
sys.waits_by_host_by_latency                       OK
sys.waits_by_user_by_latency                       OK
sys.waits_global_by_latency                        OK
sys.x$host_summary                                 OK
sys.x$host_summary_by_file_io                      OK
sys.x$host_summary_by_file_io_type                 OK
sys.x$host_summary_by_stages                       OK
sys.x$host_summary_by_statement_latency            OK
sys.x$host_summary_by_statement_type               OK
sys.x$innodb_buffer_stats_by_schema                OK
sys.x$innodb_buffer_stats_by_table                 OK
sys.x$innodb_lock_waits                            OK
sys.x$io_by_thread_by_latency                      OK
sys.x$io_global_by_file_by_bytes                   OK
sys.x$io_global_by_file_by_latency                 OK
sys.x$io_global_by_wait_by_bytes                   OK
sys.x$io_global_by_wait_by_latency                 OK
sys.x$latest_file_io                               OK
sys.x$memory_by_host_by_current_bytes              OK
sys.x$memory_by_thread_by_current_bytes            OK
sys.x$memory_by_user_by_current_bytes              OK
sys.x$memory_global_by_current_bytes               OK
sys.x$memory_global_total                          OK
sys.x$processlist                                  OK
sys.x$ps_digest_95th_percentile_by_avg_us          OK
sys.x$ps_digest_avg_latency_distribution           OK
sys.x$ps_schema_table_statistics_io                OK
sys.x$schema_flattened_keys                        OK
sys.x$schema_index_statistics                      OK
sys.x$schema_table_lock_waits                      OK
sys.x$schema_table_statistics                      OK
sys.x$schema_table_statistics_with_buffer          OK
sys.x$schema_tables_with_full_table_scans          OK
sys.x$session                                      OK
sys.x$statement_analysis                           OK
sys.x$statements_with_errors_or_warnings           OK
sys.x$statements_with_full_table_scans             OK
sys.x$statements_with_runtimes_in_95th_percentile  OK
sys.x$statements_with_sorting                      OK
sys.x$statements_with_temp_tables                  OK
sys.x$user_summary                                 OK
sys.x$user_summary_by_file_io                      OK
sys.x$user_summary_by_file_io_type                 OK
sys.x$user_summary_by_stages                       OK
sys.x$user_summary_by_statement_latency            OK
sys.x$user_summary_by_statement_type               OK
sys.x$wait_classes_global_by_avg_latency           OK
sys.x$wait_classes_global_by_latency               OK
sys.x$waits_by_host_by_latency                     OK
sys.x$waits_by_user_by_latency                     OK
sys.x$waits_global_by_latency                      OK
test
Phase 4/7: Running 'mysql_fix_privilege_tables'
'client/mariadb' --defaults-file=/tmp/mysql_upgrade-YpwsaW --database=mysql --batch --force  < /tmp/sqlP4AWre 2>&1
ERROR 1347 (HY000) at line 8: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 32: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 35: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1060 (42S21) at line 39: Duplicate column name 'Grant_priv'
ERROR 1356 (HY000) at line 43: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ERROR 1347 (HY000) at line 45: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 50: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1061 (42000) at line 51: Duplicate key name 'Grantor'
ERROR 1054 (42S22) at line 69: Unknown column 'Type' in 'columns_priv'
ERROR 1060 (42S21) at line 84: Duplicate column name 'type'
ERROR 1347 (HY000) at line 87: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1356 (HY000) at line 95: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ERROR 1347 (HY000) at line 96: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1060 (42S21) at line 100: Duplicate column name 'Create_tmp_table_priv'
ERROR 1347 (HY000) at line 103: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 105: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 107: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 111: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1356 (HY000) at line 113: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ERROR 1347 (HY000) at line 117: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1054 (42S22) at line 165: Unknown column 'thread_id' in 'general_log'
ERROR 1060 (42S21) at line 176: Duplicate column name 'thread_id'
ERROR 1060 (42S21) at line 178: Duplicate column name 'rows_affected'
ERROR 1060 (42S21) at line 200: Duplicate column name 'Create_view_priv'
ERROR 1347 (HY000) at line 202: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 203: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1060 (42S21) at line 204: Duplicate column name 'Show_view_priv'
ERROR 1347 (HY000) at line 206: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 207: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1356 (HY000) at line 208: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ERROR 1060 (42S21) at line 211: Duplicate column name 'Create_routine_priv'
ERROR 1347 (HY000) at line 213: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 214: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1060 (42S21) at line 215: Duplicate column name 'Alter_routine_priv'
ERROR 1347 (HY000) at line 217: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 218: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1060 (42S21) at line 219: Duplicate column name 'Execute_priv'
ERROR 1356 (HY000) at line 221: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ERROR 1347 (HY000) at line 223: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 224: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 227: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 228: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1356 (HY000) at line 229: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ERROR 1060 (42S21) at line 241: Duplicate column name 'Routine_type'
ERROR 1060 (42S21) at line 298: Duplicate column name 'character_set_client'
ERROR 1060 (42S21) at line 318: Duplicate column name 'collation_connection'
ERROR 1060 (42S21) at line 330: Duplicate column name 'db_collation'
ERROR 1060 (42S21) at line 345: Duplicate column name 'body_utf8'
ERROR 1060 (42S21) at line 350: Duplicate column name 'aggregate'
ERROR 1347 (HY000) at line 356: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 357: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1356 (HY000) at line 358: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ERROR 1060 (42S21) at line 359: Duplicate column name 'Event_priv'
ERROR 1060 (42S21) at line 362: Duplicate column name 'sql_mode'
ERROR 1060 (42S21) at line 401: Duplicate column name 'originator'
ERROR 1060 (42S21) at line 404: Duplicate column name 'time_zone'
ERROR 1060 (42S21) at line 406: Duplicate column name 'character_set_client'
ERROR 1060 (42S21) at line 411: Duplicate column name 'collation_connection'
ERROR 1060 (42S21) at line 416: Duplicate column name 'db_collation'
ERROR 1060 (42S21) at line 421: Duplicate column name 'body_utf8'
ERROR 1347 (HY000) at line 428: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 429: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1060 (42S21) at line 430: Duplicate column name 'Trigger_priv'
ERROR 1356 (HY000) at line 432: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ERROR 1347 (HY000) at line 435: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 436: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1356 (HY000) at line 437: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ERROR 1347 (HY000) at line 438: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1054 (42S22) at line 439: Unknown column 'Truncate_versioning_priv' in 'db'
ERROR 1347 (HY000) at line 442: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 443: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1060 (42S21) at line 444: Duplicate column name 'Delete_history_priv'
ERROR 1356 (HY000) at line 446: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ERROR 1347 (HY000) at line 447: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 449: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 450: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 451: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 452: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 453: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 454: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 455: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 456: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1347 (HY000) at line 457: 'mysql.user' is not of type 'BASE TABLE'
ERROR 1356 (HY000) at line 475: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ERROR 1347 (HY000) at line 487: 'mysql.user' is not of type 'BASE TABLE'
@hadGrantPriv:=1
1
1
1
1
1
@hadShowDbPriv:=1
1
1
1
1
1
@hadCreateViewPriv:=1
1
1
1
1
1
@hadCreateRoutinePriv:=1
1
1
1
1
1
@hadCreateUserPriv:=1
1
1
1
1
1
value
NULL
value
NULL
value
NULL
@hadEventPriv :=1
1
1
1
1
1
@hadTriggerPriv :=1
1
1
1
1
1
@hadCreateTablespacePriv :=1
1
1
1
1
1
@had_user_delete_history_priv :=1
1
1
1
1
1
Phase 5/7: Fixing table and database names
Running 'mysqlcheck' with connection arguments: --socket='/tmp/mysql.sock'
'client/mariadb-check' --defaults-file=/tmp/mysql_upgrade-YpwsaW --all-databases --fix-db-names --fix-table-names --verbose --verbose --verbose  --skip-write-binlog 2>&1
# Connecting to localhost...
# Disconnecting from localhost...
Processing databases
information_schema
mysql
performance_schema
sys
test
Phase 6/7: Checking and upgrading tables
Running 'mariadb-check' with connection arguments: --socket='/tmp/mysql.sock'
'client/mariadb-check' --defaults-file=/tmp/mysql_upgrade-YpwsaW --check-upgrade --auto-repair --verbose --verbose --verbose  --skip-write-binlog --all-databases --skip-database=mysql 2>&1
# Connecting to localhost...
# Disconnecting from localhost...
Processing databases
information_schema
performance_schema
sys
CHECK TABLE `sys_config`  FOR UPGRADE
sys.sys_config                                     OK
test
'client/mariadb' --defaults-file=/tmp/mysql_upgrade-YpwsaW --database=mysql --batch --force --silent < /tmp/sql8c5OUf 2>&1
'client/mariadb' --defaults-file=/tmp/mysql_upgrade-YpwsaW --database=mysql --batch --force --silent < /tmp/sqlFi1k2Y 2>&1
Phase 7/7: Running 'FLUSH PRIVILEGES'
'client/mariadb' --defaults-file=/tmp/mysql_upgrade-YpwsaW --database=mysql --batch --force  < /tmp/sqlFysCWQ 2>&1
OK

Comment by Daniel Black [ 2023-03-06 ]

The fix_privilege_table is known to be exceptionally verbose of sql errors, but that's mostly the way its written to append changes required so that it accounts from any very old version to MariaDB. Writing it to with the necessary precautions as very old version as very new would be a lot harder.

Looking at above output it seems a a greater use of ADD COLUMN IF NOT EXISTS and some check around mysql.user being a view could solve most excessive errors.

I was going for a 5th verbose to preserve the output compatibility for those using 4x--verbose.

So its only the "Phase 4/7: Running 'mysql_fix_privilege_tables" where client/mariadb isn't run without --verbose.

Comment by Debjyoti Ghosh [ 2023-03-06 ]

Thanks for the response, now i get it,

Phase 1/7: Checking and upgrading mysql database : as shown below this function has 3 --verbose in its arguments.
so it shows different levels of info as per the man file.

'client/mariadb-check' --defaults-file=/tmp/mysql_upgrade-YpwsaW --check-upgrade --auto-repair --verbose --verbose --verbose  --skip-write-binlog --databases mysql 2>&1

Phase 4/7: Running 'mysql_fix_privilege_tables' : in this case we do not have --verbose to show the details.

'client/mariadb' --defaults-file=/tmp/mysql_upgrade-YpwsaW --database=mysql --batch --force  < /tmp/sqlP4AWre 2>&1

If i add the verbose feature to mysql_fix_privilege_tables, should the expected output be as shown in my previous comment or some changes are required?

Also I understand the reasoning behind 5x --verbose.

Comment by Debjyoti Ghosh [ 2023-03-06 ]

I have created a PR https://github.com/MariaDB/server/pull/2530, please review

Comment by Anel Husakovic [ 2023-03-27 ]

Pushed to 10.4 with commit d575b07c

Generated at Thu Feb 08 09:30:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.