2

I was trying to upgrade my local development environment (Ubuntu 22.04 WSL) from MariaDB 10.6 to 11.4.

After updating the APT repo file, I run and apt update, which updated the server version.

However, upon running mariadb-upgrade, I see this error:

Phase 1/8: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.global_priv                                  OK
mysql.gtid_slave_pos                               OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   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.servers                                      OK
mysql.spider_link_failed_log                       OK
mysql.spider_link_mon_servers                      OK
mysql.spider_table_crd                             OK
mysql.spider_table_position_for_recovery           OK
mysql.spider_table_sts                             OK
mysql.spider_tables                                OK
mysql.spider_xa                                    OK
mysql.spider_xa_failed_log                         OK
mysql.spider_xa_member                             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
Phase 2/8: Installing used storage engines... Skipped
Phase 3/8: Running 'mysql_fix_privilege_tables'
ERROR 1062 (23000) at line 30: Duplicate entry 'db_626suite-get_98_53_metadata-PROCEDURE' for key 'PRIMARY'
ERROR 1062 (23000) at line 256: Duplicate entry 'db_626suite-get_98_53_metadata-PROCEDURE' for key 'PRIMARY'
ERROR 1062 (23000) at line 304: Duplicate entry 'db_626suite-get_98_53_metadata-PROCEDURE' for key 'PRIMARY'
ERROR 1062 (23000) at line 331: Duplicate entry 'db_626suite-get_98_53_metadata-PROCEDURE' for key 'PRIMARY'
ERROR 1062 (23000) at line 343: Duplicate entry 'db_626suite-get_98_53_metadata-PROCEDURE' for key 'PRIMARY'
FATAL ERROR: Upgrade failed

I do not understand how it is possible that there are duplicate functions, nor how to solve the problem.

Since this is just a development environment, I simply tried dropping the database, but the error persists.

Maybe the new version performs some checks that the old one didn't; but, how can I check for similar inconsistencies before running mariadb-upgrade in order to get a smooth update?

Matteo Tassinari
  • 187
  • 2
  • 16

1 Answers1

0

Thanks to a suggestion from Ergest Basha, I think I have been able to solve the issue.

My starting point was the comment they pointed out, from Kanika Satija in this comment on a similar problem I was having, on MariaDB site, which instead was found on a migration from MySQL to MariaDB:

When migrating from MySQL to MariaDB, MariaDB has some different definitions for certain privilege tables(proc and event).This means that the structures of some of the MySQL tables are not valid for MariaDB.

Your issue “Phase 4/4: Running 'mysql_fix_privilege_tables' ERROR 1062 (23000) at line 577: Duplicate entry 'tracs_dataf-grmt_updt-PROCEDURE' for key 'PRIMARY' FATAL ERROR: Upgrade failed” is regarding table “mysql.proc”. This table holds stored procedures and stored functions, collectively known as "Stored Routines".

After migration from mysql to mariadb , resolve this issue by following below steps:

  1. Take dump of mysql.proctable mysqldump -uroot -p mysql proc > /tmp/mysql-proc.sql

  2. Drop proc table mysql -u root -p mysql MariaDB [mysql]> drop table proc; MariaDB [mysql]>\q

  3. Run mysql upgrade mysql_upgrade

  4. Restore proc table mysql -uroot -p mysql < /tmp/mysql-proc.sql

HOWEVER in my case I had to add an intermediate step between steps 3 and 4, where I modified the file /tmp/mysql-proc.sql to replace all INSERT INTO commands with INSERT IGNORE INTO:

3.a. sed -i 's/INSERT INTO/INSERT IGNORE INTO/' /tmp/mysql-proc.sql

After doing this, I was able to complete the upgrade procedure.

Matteo Tassinari
  • 187
  • 2
  • 16