Database errors can cause website issues such as blank pages, failed logins, or content not loading. cPanel provides several ways to check database error logs so you can diagnose and fix problems. This guide covers the most common methods.
Checking MySQL Errors via phpMyAdmin
- Log in to your cPanel account.
- Scroll to the Databases section and click phpMyAdmin.
- Click on the database you want to inspect.
- Click on a table to check for errors at the table level.
- Click the Operations tab to check table maintenance status.
Checking Website Error Logs
If a database error is affecting your website (e.g., WordPress), the error details are often logged in your account error logs:
- In cPanel, go to Metrics → Errors.
- Select the domain from the dropdown menu.
- Scroll through the log entries. Database-related errors typically contain messages like:
MySQL server has gone awayError establishing a database connectionTable does not existAccess denied for userMySQL syntax error
Enabling WordPress Debug Logging
If your website uses WordPress, you can enable debug logging to capture detailed database errors:
- In cPanel, go to Files → File Manager.
- Navigate to
public_htmland open thewp-config.phpfile. - Find the line
define( 'WP_DEBUG', false );and change it to:define( 'WP_DEBUG', true );define( 'WP_DEBUG_LOG', true );define( 'WP_DEBUG_DISPLAY', false );
- Save the file. Errors will now be logged to
wp-content/debug.log. - To view the log, navigate to
public_html/wp-content/debug.login File Manager.
Important: Disable debug mode once you have resolved the issue. Leaving it enabled on a live site can expose sensitive information.
Common Database Error Messages and What They Mean
- "Error establishing a database connection": The database credentials in your configuration file are wrong, the database user does not have sufficient privileges, or the MySQL server is down.
- "Table does not exist": The table was deleted or not properly created during installation. You may need to restore from backup.
- "MySQL server has gone away": The query took too long or the database connection timed out. Often caused by large imports or heavy database queries.
- "Access denied for user": The username or password is incorrect, or the user has not been assigned to the database.
- "Got error -1 from storage engine": The database table may be corrupted. Run a repair using phpMyAdmin.
Important Notes
- Error logs can grow large over time. Periodically check and clear old logs.
- Always back up your database before attempting repairs based on error log analysis.
- If you are unsure how to interpret an error, contact your hosting provider with the specific error message.
Troubleshooting
Error log is empty but website shows errors:
- Check if error logging is enabled in your application (e.g., WordPress debug mode).
- Try accessing the website and then immediately refresh the error log page.
Cannot find the Errors page in cPanel:
- Your hosting provider may have disabled this feature. Try checking error logs via FTP in the
/logs/directory instead.
Database error persists after following log instructions:
- Contact your hosting provider with the specific error message. They can check server-level MySQL logs.