Was getting this error while trying to upgrade mysql in WHM/cPanel,
Your server’s MySQL/MariaDB RPM target is set to “unmanaged”. You cannot use the MySQL/MariaDB Upgrade feature while your server is in this state.
The issue was due to entry in file /var/cpanel/rpm.versions.d/local.versions set mysql to unmanaged
Went ahead and set it to managed and was able to upgrade mysql from WHM without any issues