Updated: 29 September 2026 · Applies to: MariaDB 10.6 to 11.4 and MySQL 8.0 and 8.4 on cPanel & WHM 138 (AlmaLinux, Rocky Linux, CloudLinux)
When MySQL or MariaDB on a cPanel server stops answering, crashes, or hangs when WHM tries to restart it, websites show database connection errors. The usual causes are too few open-file handles, too little memory, damaged tables, or a flood of slow queries. Work through the checks below in order. Paths and service names were checked on a cPanel & WHM 138 server with MariaDB 11.4.
1. Read the error log first
mysql -N -e "SELECT @@log_error" # where the error log is tail -100 /var/lib/mysql/$(hostname).err # the usual location on cPanel journalctl -u mariadb -n 50 --no-pager # or: -u mysqld for MySQL
The last lines before a crash or failed start usually name the problem. If MariaDB does not answer at all, check whether it is running with systemctl status mariadb (or mysqld).
2. "Too many open files"
Each table and connection uses file handles. Two limits apply: the systemd limit for the service and MariaDB's own open_files_limit. Check the current values:
systemctl show mariadb -p LimitNOFILE mysql -e "SHOW GLOBAL VARIABLES LIKE 'open_files_limit'"
Raise the systemd limit with a drop-in file, for example /etc/systemd/system/mariadb.service.d/limits.conf (use mysqld.service.d for MySQL):
[Service] LimitNOFILE=100000
Files in that folder are read in name order, and for the same setting the last file wins; check all of them with systemctl cat mariadb. Then set open_files_limit in the [mysqld] section of /etc/my.cnf if needed, and restart:
systemctl daemon-reload /usr/local/cpanel/scripts/restartsrv_mysql
3. Memory and the out-of-memory killer
dmesg -T | grep -i -E "out of memory|killed process" free -h mysql -e "SELECT @@innodb_buffer_pool_size/1024/1024 AS buffer_pool_mb, @@max_connections"
If the kernel killed mariadbd or mysqld, the server ran out of memory. Size innodb_buffer_pool_size so that the database, PHP-FPM, Apache and mail all fit into RAM together, and lower max_connections if thousands of connections are allowed that the server could never serve.
4. Slow queries and connection floods
mysql -e "SHOW FULL PROCESSLIST" | head -50 mysqladmin status
Many connections in the same state, or queries running for minutes, point to a busy site, a plugin that runs heavy queries, or a bot flood. Find the account from the database name (cPanel prefixes database names with the account name), and enable the slow query log to find the queries: slow_query_log = 1 and long_query_time = 2 in /etc/my.cnf.
5. Damaged tables
mysqlcheck --all-databases --check
MyISAM tables can be repaired with mysqlcheck --auto-repair, or per database in WHM under SQL Services > Repair a MySQL Database. InnoDB tables repair themselves at start-up in most cases; if the error log shows InnoDB corruption that stops the server from starting, take a copy of /var/lib/mysql and restore the affected databases from backup. The innodb_force_recovery setting is a last resort for rescuing data, not a fix.
6. Restarts that hang
A clean shutdown writes all changed data to disk, which can take minutes with a large buffer pool. Do not kill the process during a shutdown: that turns a slow restart into crash recovery. Watch progress in the error log, and restart during quiet hours when possible.
If you would rather have us look at it, see our cPanel server management.
Official documentation: MariaDB server system variables and cPanel & WHM documentation.