Site: US UK AU |

How to repair MySQL tables

How to repair MySQL tables

This article explains how to repair crashed MySQL tables using either phpMyAdmin or the MySQL CLI.

If you encounter MySQL time-out errors or unexpected restarts, the likely cause is one or more crashed database tables. Repairing the crashed tables will likely solve the issue, though this may cause the loss of some data.If you are uncomfortable with losing data, then using a recent database dump to restore the database may mitigate this loss. However, if the date of your last database dump is not recent, it can result in greater data loss than simply repairing the table.

Repairing crashed tables with phpMyAdmin

You can access phpMyAdmin from your SiteWorx account:  

  1. Log in to your SiteWorx account.

    • If you do not know your password, click Forgot your password on the login page.
    • If you do not know the web address for your SiteWorx login page, either refer to your Welcome Email or contact our 24-hour Support Team for assistance.
  2. On the left, select Hosting Features > MySQL > PhpMyAdmin (Figure 1).

Figure 1. Hosting Features > MySQL > PhpMyAdmin selection in SiteWorx.

  1. Select the correct database from the list on the left (Figure 2).

Figure 2. Database selection in phpMyAdmin.

  1. Select the check box corresponding to the corrupted table, and from the With selected list, click Repair table (Figure 3).

Figure 3. List of tables in phpMyAdmin and Repair table selection.

Repairing crashed tables with the MySQL CLI

Use this procedure to repair MySQL tables from the command line:

  1. Log in to the server using SSH.
  2. From the command line, enter this command, replacing [username] with your username and without the brackets:

    mysql -u [username] -p

  3. Enter your password.
  4. Again, without the brackets, enter the command:

    use [databasename];

  5. Enter the command:

    show tables;

  6. Unlike phpMyAdmin, there is no way to repair multiple tables with one command. Instead, you must issue one command per table:
    1. To check a table for errors, enter:

      check table [yourtablename];

    2. To repair a table, enter:

      repair table [yourtablename];

  7. Type quit to return to the command prompt.

External resources

For the complete MySQL documentation, refer to the MySQL development website.

For 24-hour assistance any day of the year, contact our Support Team by email or through the Client Portal.

Article Rating (2 Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
How to reset your SSH password and add SSH keys in SiteWorx
Added on Wed, Feb 8, 2017
How to change email account passwords in SiteWorx
Added on Mon, Aug 5, 2013
How to configure DNS records in SiteWorx
Added on Tue, Jul 31, 2018
How to view your bandwidth usage
Added on Wed, May 23, 2018
How to secure your SiteWorx account
Added on Tue, Dec 9, 2014
How to show running MySQL queries
Added on Fri, Nov 13, 2015
How to enable SSH access
Added on Tue, Jun 6, 2017
How to create CNAME URLs with Edgecast CDNs
Added on Tue, Sep 10, 2013
How to add secondary domains with SiteWorx
Added on Fri, Jun 1, 2018
How to create a subdomain with SiteWorx
Added on Mon, Aug 5, 2013