adminbin Cpanel/cpmysql/DBCACHE: exit 11adminbin Cpanel/cpmysql/DBCACHE: exit 11

Because of Bug in the CPanel release lots of our client are facing issue that 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-10  -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

To fix the issue please follow below steps.

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.