Database corruption can halt online operations and lead to lost data, time, and money. Below we’ll cover how to troubleshoot and resolve MySQL server corruption.
Database Corruption Troubleshooting
1. Identify the Problem
Issues vary depending on your server environment. Are there unexplained glitches in your web site or app? Are you seeing PHP errors on pages that aren’t changed directly? Even if errors are intermittent, you should resolve them immediately. Public errors often share information cyber attackers can use against you.
Content management systems (CMSs) using MySQL databases, including Drupal and Joomla, may display a database error notification in the administrator dashboard natively or with third party integrations. WordPress has a specific error code for db corruption: a blank public-facing page stating “Error Establishing a Database Connection.”
2. Gather Info to Discover the Probable Cause(s)
What was the last thing you remember doing before the problem started?
- Did you install a new integration?
- Upgrade any software?
- Delete, move, or edit a file?
- Upload large files to your server?
- Run an antivirus scanner that can quarantine suspicious files?
- Update the database while the server or MySQL service restarted?
Note all possibilities.
Check system error logs for additional information on when the issue started and what can be causing it. PHP applications sometimes maintain an error_log file in the root directory that can aid troubleshooting.
3. Try to Reproduce the Error
If it was an error page that showed at random, try to open multiple tabs from the same site within a few seconds. View the site in different desktop and mobile browsers. If the error started after something you installed, uninstall and reinstall it exactly as instructed in official documentation.
4. Fix the Issue
First, ensure you have database backups from sometime before the problem arose. For reassurance you should create another database backup.
Check the storage limit of your hosting plan. Exceeding disk space limits is a common symptom for maximum concurrent connections (max_user_connections) errors. You can check this with cPanel > Disk Usage and the df
terminal command. Delete junk files and old backups. Make necessary changes to prevent excessive junk files in the future.
If you find nothing you can delete, you should upgrade your hosting plan for better database performance.
“Check and repair database” is the common go-to quick fix with one of the following:
- cPanel > MySQL® Databases
- phpMyAdmin
- Native PHP software features
- MySQL Command-line Client:
mysqlcheck --repair -u [USERNAME] -p [DATABASE]
Depending on your PHP application, or if you’re not using a cPanel server, you may have to use different options for repairing databases. WordPress users with WP-CLI installed can check and repair databases with the combination of two commands:
wp db check && wp db repair
WordPress can be configured to do this automatically by adding a short code block in the wp-config.php file:
define (‘WP_ALLOW_REPAIR’, ‘true’);
If that doesn’t work, contact Live Support with the issue you’re having and what you’ve tried to repair the database corruption. Our system administrators may be able to repair corrupt MySQL databases with InnoDB functions and help investigate the cause of corruption.
If all database repair methods are unsuccessful, you’ll need to know how to recover corrupted MySQL databases with backups via phpMyAdmin or SSH.
5. Document the Resolution
If this article or an external webpage helped you, bookmark it with a title you’ll remember. If it was an issue with the code, type the steps you took somewhere for safekeeping.
Review your backup schedule for any benefits of implementing differential or incremental backups.
Enjoy high-performance, lightning-fast servers with increased security and maximum up-time with our Secure VPS Hosting!
Linux VPS cPanel or Control Web Panel Scalable Website Migration Assistance