The unfortunate happens, your MySQL database tables are corrupted and you need to repair them. How do we know they are corrupt? Error messages typically, but good house keeping to check every so often anyway. There still could be a database table corruption. So this guide is useful as part of maintaining your own wordpress hosted blog, mybb forum, joomla cms, website baker or any other MySQL powered site.
Please note you follow this guide at your own risk. I’m not to be held responsible for any lose of data!
There are so many messages that make me take note and check. A few are:
‘error in establishing a database connection’
‘SQL Error: 1040 – Too many connections’.
‘SQL Error: 2013 – Lost connection to MySQL server during query’.
Notice the above error messages might not actually mean database table corruption. However I’ve seen these messsages and eventually have had to repair my MySQL database tables. Essentially I’m saying one problem can lead onto another. So if you experience MySQL problems in general, could be worth checking.
So how do you check? Easiest way is to use phpmyadmin. Many host providers provide phpmyadmin access via their control panel. I’m fortunate that my control panel has phpmyadmin access. However there are some host providers that don’t supply adequate MySQL administrative features.
If all you have is ftp access and database details then you might still be able to use phpmyadmin by installing this yourself. It is really easy to setup a version of phpmyadmin on a server and I’ve done this whilst supporting others. You configure the config.inc.php file (typically change the blowfish secret and put in the server details) in the latest version of the phpmyadmin package and upload the folder to your hosting. I would change the folder name for security reasons. If your paranoid you can always password secure the folder. However I’ve only temporary left phpmyadmin on a server whilst using it and never place a username or password in the configuration details, so personally never bothered.
Checking and repairing tables
1. So once logged into the phpmyadmin package you want to view the database structure.
2. If you notice any entries with stats in the overhead column these are the ones to repair. So select those particular ones by ticking the boxes on the left.
3. At the bottom there is a ‘with selected’ drop-down menu. Select ‘Repair Table’.
4. Tables should be repaired, you can now log out of phpmyadmin.
Hope someone finds this guide useful.