MySQL Not Restarting in cPanel: Troubleshooting Steps
If MySQL won't restart on your cPanel server, here's a systematic approach to diagnose and fix the issue:
Step 1: Check MySQL Error Logs
First identify why MySQL won't start by checking the error logs:
Download
tail -n 100 /var/lib/mysql/hostname.err # or tail -n 100 /var/log/mysqld.log
Common log locations:
/var/log/mysqld.log
/var/lib/mysql/hostname.err
(replace hostname with your server's hostname)/usr/local/mysql/data/hostname.err
Step 2: Common Fixes Based on Errors
A. Insufficient Memory
Symptoms: "Could not allocate memory" errors
Fix:
Download
# Reduce MySQL memory settings in my.cnf nano /etc/my.cnf
Add/modify these values (adjust based on your server RAM):
Download
innodb_buffer_pool_size = 64M key_buffer_size = 32M query_cache_size = 32M
B. Corrupt Tables
Symptoms: "Table is marked as crashed" errors
Fix:
Download
# Repair all databases mysqlcheck -A --auto-repair -u root -p
C. Disk Space Issues
Symptoms: "No space left on device"
Fix:
Download
df -h # Check disk space # If /var is full: rm -f /var/lib/mysql/ib_logfile* # Remove old log files (MySQL will recreate them)
D. Permission Issues
Symptoms: "Can't create/write to file" errors
Fix:
Download
chown -R mysql:mysql /var/lib/mysql chmod -R 755 /var/lib/mysql
Step 3: Manual MySQL Start Attempt
Try starting MySQL manually with logging:
Download
/usr/bin/mysqld_safe --log-error=/var/log/mysqld.log &
Step 4: Advanced Troubleshooting
Check for Zombie Processes
ps aux | grep mysql kill -9 [PID] # For any stuck MySQL processes
Verify Configuration
mysqld --verbose --help | grep -A 1 "Default options"
Check for Port Conflicts
netstat -tulnp | grep 3306
Step 5: Final Restart Attempt
After applying fixes:
/scripts/restartsrv_mysql # or service mysqld restart # or for newer systems systemctl restart mysqld
Step 6: If All Else Fails
Start in recovery mode:
mysqld_safe --skip-grant-tables &
Reinstall MySQL(last resort):
yum remove mysql mysql-server rm -rf /var/lib/mysql yum install mysql mysql-server /scripts/restartsrv_mysql
cPanel-Specific Tips
Use WHM's "MySQL Server Status" (Home > SQL Services > MySQL Server Status)
Check "MySQL Management" in WHM for configuration options
Consider running
/scripts/mysqlup --force
if upgrading failed
Always back up your databases before attempting major repairs or reinstalls. If you're not comfortable with these steps, contact Imageleet support team and we will be glad to assist.