Updating MariaDB to v10.2.35 or v10.3.26 is showing MySQL Databases as offline in cPanel.

You might see your cPanel is showing The MySQL server is currently offline after updating MariaDB to v10.2.35 or v10.3.26. Also, you will not be able to create a database from cPanel.

Issue :

Updating the existing MariaDB to v10.2.35 or v10.3.26 won't allow cPanel to read access properly. This will lead your website to become inaccessible and databases will not be able to create. Also, you will find the below error at the MySQL Database page inside the cPanel interface.

[2020-11-05 10:17:55 +0000] warn [cpmysql] Error (Invalid grant string: SET DEFAULT ROLE 0 FOR '$user'@'$host'
) while parsing grant: SET DEFAULT ROLE 0 FOR '$user'@'$host' at /usr/local/cpanel/Cpanel/Mysql.pm line 956,  line 1.
Cpanel::Mysql::__ANON__(__CPANEL_HIDDEN__...) called at /usr/local/cpanel/3rdparty/perl/530/lib/perl5/cpanel_lib/Try/Tiny.pm line 118

Fix :

  1. Here, we will alter the MySQL Database Column order. Please refer to the following steps to make these changes.

  2. Take your MySQL database backup. Ensure that you are logged in as the root user to execute this command.
    mysqldump mysql > /home/backup/mysql.sql
  3. After then execute the below command to alter the database column order. This will make the proper alteration for the databases.

    mysql -e "ALTER TABLE mysql.user MODIFY IF EXISTS password_last_changed timestamp DEFAULT CURRENT_TIMESTAMP NULL AFTER max_statement_time, MODIFY IF EXISTS password_lifetime smallint unsigned DEFAULT NULL AFTER password_last_changed, MODIFY IF EXISTS account_locked enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL after password_lifetime;"
  4. Restart the MariaDB Service.

    #systemctl restart mariadb

    These changes will come into effect immediately.

Was this answer helpful?

« Back