cPanel MySQL/MariaBB error: adminbin Cpanel/cpmysql/DBCACHE: exit 11

cPanel MySQL/MariaBB error: adminbin Cpanel/cpmysql/DBCACHE: exit 11

Today lots of clients having cPanel server contacted us saying that their MySQL is showing down in cPanel interface. But the MySQL/MariaDB was still running. It’s only the cPanel interface that was showing the error. And cPanel error logs were being populated with below string.

Invalid grant string: SET DEFAULT ROLE 0 FOR 'xxxxxxxx'@'xx.xx.xx.xx'
[2020-11-04 07:35:30 -0500] warn [cpanel] Cpanel::Wrap::send_cpwrapd_request adminbin Cpanel/cpmysql/DBCACHE: exit 11: namespace=[Cpanel] module=[cpmysql] function=[DBCACHE]: set error in context mysql: raw_response=[{"mode":"simple","status":1,"statusmsg":"adminbin Cpanel/cpmysql/DBCACHE: exit 11","error":1,"exit_code":2816,"action":"run","version":"2.4","timeout":0,"data":""}] at /usr/local/cpanel/Cpanel/Wrap.pm line 120, <$socket> line 1.
        Cpanel::Wrap::send_cpwrapd_request("namespace", "Cpanel", "module", "cpmysql", "function", "DBCACHE", "data", "", ...) called at /usr/local/cpanel/Cpanel/AdminBin.pm line 57
        Cpanel::AdminBin::adminrun("cpmysql", "DBCACHE", undef) called at /usr/local/cpanel/Cpanel/MysqlFE/DB.pm line 236
        Cpanel::MysqlFE::DB::_initcache() called at /usr/local/cpanel/Cpanel/Template/Plugin/Mysql.pm line 196

So we investigated and found that it was a cPanel bug and cPanel team confirmed it. They also published an article with workaround to fix it. You can check the article here.

We applied the workaround and everything was back to normal.

Workaround

First backup your MySQL database

mysqldump mysql > /root/mysql.sql

The we have to alter the database column order. You can do it by running below command.

mysql -e "ALTER TABLE mysql.user MODIFY COLUMN password_last_changed timestamp AFTER max_statement_time, MODIFY COLUMN password_lifetime smallint AFTER password_last_changed, MODIFY COLUMN account_locked enum('N','Y') AFTER password_lifetime"

Then restart the MySQL

/scripts/restartsrv_mysql 

And the error showing up in cPanel will be gone.