MariaDB upgrade to 2.7 fails - Multiple accounts exist for @user_name, @host_name

I posted this to GitHub, but I think the community may be a better place.
For reference: MariaDB upgrade to 2.7 fails - Multiple accounts exist for @user_name, @host_name · Issue #3768 · home-assistant/addons · GitHub

Describe the issue you are experiencing

I searched and couldn’t find a similar issue. MariaDB 2.6.1 is running fine. When I try to upgrade to 2.7.1 after a clean shutdown, I get the following error.

[09:57:43] INFO: Ensuring internal database upgrades are performed
ERROR 1644 (45000) at line 475: Multiple accounts exist for @user_name, @host_name that differ only in Host lettercase; remove all except one of them
FATAL ERROR: Upgrade failed
s6-rc: warning: unable to start service mariadb-post: command exited 1
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
/run/s6/basedir/scripts/rc.init: fatal: stopping the container.
s6-rc: info: service mariadb-core: stopping

Restored my 2.6.1 backup

I loaded phpMyAdmin and saw duplicated users. Deleted the duplicated row. No idea how that got there.

After:

After deleting the duplicate ‘service’ user, I restarted the addon. 2.6 reloads fine. I try another upgrade and get the same error.

Restored my 2.6.1 backup.

Back up and running with older version.

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Home Assistant Operating System

Which add-on are you reporting an issue with?

MariaDB

What is the version of the add-on?

2.6.1

Steps to reproduce the issue

  1. Try upgrade of mariadb from 2.6.1 to 2.7.1
  2. Upgrade fails
  3. Restore
  4. Delete duplicate user.
  5. Try upgrade again.
  6. Upgrade fails

Additional information

Core 2024.9.2
Supervisor 2024.09.1
Operating System 13.1
Frontend 20240909.1

Running on Intel NUC