Mysql_upgrade fails, table is corrupted

mariadbmariadb-10.2MySQLupgrade

I have a mariaDB with a table that is corrupted. It's useless data to me, so I've tried to drop the schema but it won't drop. Instead, it gives me this error when trying to drop it:

"Error Code: 1805. Column count of mysql.proc is wrong. Expected 20, found 21. The table is probably corrupted."

I've read on here that I should try to run a mysql_upgrade to fix this issue. But this also has failed when I point to the MariaDB bin directory and run this command line:

C:\Program Files\MariaDB 10.2\bin>mysql_upgrade --force -h localhost -uroot -p -
P3307

This is the results I get from it:

    Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.engine_cost                                  OK
mysql.event                                        OK
mysql.func                                         OK
mysql.gtid_executed                                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                           OK
mysql.innodb_table_stats                           OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.roles_mapping                                OK
mysql.server_cost                                  OK
mysql.servers                                      OK
mysql.slave_master_info                            OK
mysql.slave_relay_log_info                         OK
mysql.slave_worker_info                            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.transaction_registry                         OK
mysql.user                                         OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
Phase 4/7: Running 'mysql_fix_privilege_tables'
ERROR 1408 (HY000) at line 545: Event Scheduler: An error occurred when initiali
zing system tables. Disabling the Event Scheduler.
ERROR 1805 (HY000) at line 572: Column count of mysql.proc is wrong. Expected 20
, found 21. The table is probably corrupted
ERROR 1805 (HY000) at line 574: Column count of mysql.proc is wrong. Expected 20
, found 21. The table is probably corrupted
ERROR 1805 (HY000) at line 582: Column count of mysql.proc is wrong. Expected 20
, found 21. The table is probably corrupted
ERROR 1805 (HY000) at line 584: Column count of mysql.proc is wrong. Expected 20
, found 21. The table is probably corrupted
FATAL ERROR: Upgrade failed

Any advice on how to resolve this?

Best Answer

10.2.6 is a really old version from 2017, and the first table reelase..

Consider upgrading to latest 10.2 version (e.g. 10.2.25).

You table probably isn't corrupt, just has the wrong definition. In 10.2.6 it should look like this. Look to see what you need to alter to make this your table definition.