mysql_upgrade: "FATAL ERROR: Upgrade failed"

I’m using a third-party control panel (ISPmanager) The problem is I cannot create a backup using the panel. The error message makes me think it’s the problem with MySQL.

Apr 9 06:17:43 Backuping 'MySQL->sims' failed: Unable to dump sims database: mysqldump: Couldn't execute 'SHOW FUNCTION STATUS WHERE Db = 'sims'': Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50077, now running 50524. Please use mysql_upgrade to fix this error. (1558)
. Skip it.
Apr 9 06:17:43 ----Backuping of user 'alice' failed: code=8 Code 8 . Skip it.
Apr 9 06:17:43 ----Backuping of user 'bob' failed: code=8 Code 8 . Skip it.
Apr 9 06:17:43 ----Backuping of user 'charlie' failed: code=8 Code 8 . Skip it.
Apr 9 06:17:43 ----Backuping of user 'dan' failed: code=8 Code 8 . Skip it.
Apr 9 06:17:43 ----Backuping of user 'ftp' failed: code=8 Code 8 . Skip it.
Apr 9 06:17:44 ----Backuping of user 'oscar' failed: Home folder /var/www/html/igroklik.ru/ of user 'ingmar.ru' does not exist. Skip it.
Apr 9 06:17:45 ----Backuping of user 'peggy' failed: code=8 Code 8 . Skip it.
Apr 9 06:17:47 Backuping 'MySQL->serank' failed: Unable to dump serank database: mysqldump: Couldn't execute 'SHOW FUNCTION STATUS WHERE Db = 'serank'': Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50077, now running 50524. Please use mysql_upgrade to fix this error. (1558)
. Skip it.
Apr 9 07:32:18 ----Backuping of user 'sites' failed: code=8 Code 8 . Skip it.
Apr 9 07:32:18 ----Backuping of user 'test' failed: code=8 Code 8 . Skip it.
Apr 9 07:32:22 Backuping 'MySQL->mysql' failed: Unable to dump mysql database: mysqldump: Couldn't execute 'SHOW FUNCTION STATUS WHERE Db = 'mysql'': Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50077, now running 50524. Please use mysql_upgrade to fix this error. (1558)
. Skip it.
Apr 9 18:46:02 Backup ERROR (global block): Failed to run upload: code=7, Couldn't connect to server
Apr 9 18:46:24 Backup ERROR (global block): Failed to run upload: code=67, Login denied

Panel’s support tells me to run mysql_upgrade. I ssh to the server and run mysql_upgrade, it returns:

Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/lib/mysql/mysql.sock' 
Failed to ALTER DATABASE `#mysql50#.cache` UPGRADE DATA DIRECTORY NAME
Error: Incorrect database name '#mysql50#.cache'
Failed to ALTER DATABASE `#mysql50#.config` UPGRADE DATA DIRECTORY NAME
Error: Incorrect database name '#mysql50#.config'
Failed to ALTER DATABASE `#mysql50#.local` UPGRADE DATA DIRECTORY NAME
Error: Incorrect database name '#mysql50#.local'
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/lib/mysql/mysql.sock' 
mysqlcheck: Got error: 1102: Incorrect database name '#mysql50#.cache' when selecting the database
FATAL ERROR: Upgrade failed

I tried to delete ‘#mysql50#.cache’ via PhpMyAdmin - it throws:

#1102 - Incorrect database name '#mysql50#.cache'

What can I do?