Fix "The MySQL server is currently offline" issue in cPanel

If you're experiencing issues with the latest version of MariaDB on your cPanel server-such as the MySQL service showing as offline or errors when accessing the MySQL Databases section—this guide provides a series of steps to help identify and resolve the problem.

Step 1: Run the AutoFix Script

Start by attempting an automated repair using the following cPanel-provided script:

/scripts/autorepair fix_mariadb_show_grants_roles

This script is designed to correct issues related to MariaDB roles and permissions that can prevent the MySQL server from functioning properly. After running the script, check whether the MySQL service is back online.

Step 2: Check the cPanel Error Log

If the autofix does not resolve the issue, review the cPanel error log for any related messages:

tail -n 50 /usr/local/cpanel/logs/error_log

Look for errors or warnings related to MySQL or MariaDB. This log often contains valuable clues that can help with further troubleshooting.

Step 3: Resolve the “CpuserNotInMap” Error

If you see the following error while trying to access the MySQL Databases page in cPanel:

Cpanel::Exception::Database::CpuserNotInMap/(XID xfttxq)
The cPanel user "username" does not exist in the database map

This indicates that the user is missing from the internal database mapping. You can resolve this by rebuilding the database map for the affected cPanel user:

/scripts/rebuild_dbmap $user

Be sure to replace $user with the actual username of the cPanel account.

Step 4: Rebuild the Database Map for All Users (Optional)

If the issue affects multiple accounts, or you're unsure which users are impacted, you can rebuild the database map for all cPanel users with the following command:

for user in $(ls /var/cpanel/users); do /scripts/rebuild_dbmap $user; done

This will iterate through every cPanel account on the server and regenerate their database mappings.

Additional Step: Restart MySQL

Once you’ve completed the above steps, it’s a good idea to restart the MySQL service to ensure changes take effect:

systemctl restart mysql

You can verify that MySQL is running with:

mysqladmin ping

Conclusion

These steps should help resolve issues related to MariaDB updates causing MySQL to go offline or break cPanel account database mappings. If problems persist after completing these actions, consider opening a support ticket.

  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

Domain names are not showing in WHM

We were unable to see any domains listed under WHM -> List Accounts. However, we can see the...

How to Start/Stop or Restart Apache server

Apache is the HTTP server that is freely available over the internet. It is a kind of software or...

How to install Attracta SEO Tools plugin

RequirementscPanel/WHM needs to be installed on your server. Step 1: SSH into your server and go...

How to Install CpCleaner in cPanel through SSH?

Installation Run the following shell commands as root via SSH: wget -O cpc-1.0.3.tar...

How to Secure a cPanel/WHM Web Server

Here are a few basic steps that you should keep in mind for keeping a server secure. 1) Strong...