cPanel

How to Fix the “mysql has failed” Error on a cPanel Server

cPanel says mysql has failed and will not recover? Find the cause in the MySQL error log and fix the common ones: full disk, memory, crashes and bad updates.

cPanel checks its services every few minutes. When MySQL stops and cannot be restarted, it sends an alert like this:

mysql has failed. Contact your system administrator if the service does not automagically recover.

While MySQL is down, every website that uses a database shows an error, so this needs fixing quickly. The message itself does not say why MySQL stopped. This guide shows how to find the reason and fix the most common causes.

Quick answer

  1. Look at the end of the MySQL error log: tail -n 50 /var/lib/mysql/$(hostname).err.
  2. Check the disk is not full (df -h) and the server is not out of memory.
  3. Fix what the log shows, then start MySQL with /scripts/restartsrv_mysql.
  4. If the log shows mysqld got signal 11 right after a MySQL update, the update is the likely cause: update to the newest version in your series.

What you need: root SSH access. Take a backup before changing any MySQL files or packages.

1. Check whether MySQL is running

systemctl status mysqld

active (running) means MySQL has recovered on its own, and you only need to find out why it stopped. failed or inactive means it is still down. On servers running MariaDB instead of MySQL, the service is called mariadb.

2. Read the MySQL error log

The error log nearly always says why MySQL stopped. On cPanel servers it is named after the server's hostname:

tail -n 50 /var/lib/mysql/$(hostname).err

If that file does not exist, the system log has the same messages:

journalctl -u mysqld -n 50 --no-pager

Read from the bottom up. The last [ERROR] lines before the shutdown are the ones that matter.

3. Match the log to the cause

The disk is full

The log shows No space left on device or Errcode: 28. Check free space:

df -h

If / or /var is at 100%, MySQL cannot write and stops. Free some space (old backups and large log files are the usual suspects), then start MySQL again. See How to Check Disk Space in Linux for how to find what is using the space.

The server ran out of memory

The log simply stops with no error, or the kernel log shows MySQL being killed:

journalctl -k | grep -i 'out of memory'

Linux stops the largest process when memory runs out, which is often MySQL. Start MySQL again, then reduce the load: lower innodb_buffer_pool_size in /etc/my.cnf, check for runaway PHP processes, or add memory.

MySQL crashes with signal 11

The log shows a crash during startup:

[System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysqld got signal 11 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.

Signal 11 means MySQL itself crashed. If it started right after an automatic MySQL update, a bug in that version is the most likely cause.

A real example: in July 2024, MySQL 8.0.38 could not restart on servers with a very large number of tables (8,001 or more), which is common on shared hosting servers. cPanel servers updated automatically, and MySQL went down with exactly this error. The fix came out in MySQL 8.0.39 on 23 July 2024. MySQL 8.0.39 release notes

When you see this, check your version and update to the newest release in the same series:

mysqld --version
dnf update 'mysql-community-*'

If no fixed version exists yet, going back to the previous version (dnf downgrade 'mysql-community-*') is a temporary workaround. Update again once the fix is released.

If the crash keeps happening on an up-to-date version, test the server's memory and disks: signal 11 can also be caused by faulty hardware.

InnoDB data is damaged

The log mentions corruption, checksum mismatch or [InnoDB] Database page corruption. This often follows a power cut or a failing disk. Do not delete files from /var/lib/mysql. Copy the whole folder somewhere safe first, check the disk's health, and restore the affected databases from your backups. Recovery modes such as innodb_force_recovery exist, but they can make things worse when used wrongly, so treat them as a last resort.

4. Start MySQL and confirm it stays up

Once the cause is fixed, start MySQL with cPanel's own script:

/scripts/restartsrv_mysql

Then check it is running, and check again a few minutes later:

systemctl status mysqld

Also open one of your websites to confirm it loads.

Keep MySQL on a supported version

MySQL 8.0 reached end of life in April 2026 (with version 8.0.46) and no longer gets security fixes. MySQL 8.0 release notes If your server still runs MySQL 8.0, plan an upgrade with WHM's MySQL/MariaDB Upgrade tool, after taking a full backup of your databases.

Sources

  1. MySQL 8.0.39 release notes
  2. MySQL 8.0 release notes (end of life notice)

Written by Tharanga. Commands and procedures depend on your system and software version.

How we approach technical guides →
FOLLOW THE THREAD

Keep exploring

All guides