Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Repair a MySQL Database in cPanel, WHM and phpMyAdmin

This guide shows three ways to repair a damaged MySQL database.

Databases2 min read15 steps11 screenshots

Why repair a database?

A database is a store for your website's information, kept in tables. Sometimes a table gets damaged. This can happen after a server crash, a full disk or a sudden power cut. Your site may then show errors like "table is marked as crashed".

A repair tries to fix the table so MySQL can read it again. Take a backup first if you can. A repair works on the table in place, and it can sometimes lose rows that were already broken.

Method 1: cPanel

  1. Log in to cPanel.
  2. Open MySQL Databases in the Databases section.
    Screenshot: Open MySQL Databases in the Databases section.
  3. Find Modify Databases.
  4. Under Check Database, pick your database and click Check Database. Read the result.
  5. Under Repair Database, pick the database and click Repair Database.
    Screenshot: Under Repair Database , pick the database and click Repair Database .
  6. Wait for the "OK" messages, then test your site.

Method 2: phpMyAdmin

phpMyAdmin is a web tool for working with databases.

  1. Open phpMyAdmin from cPanel.
  2. Click your database in the left list.
  3. Tick the boxes beside the broken tables. Use Check all to select every table.
  4. In the With selected drop-down, choose Repair table.
  5. Read the results.

Repair works for MyISAM tables. For InnoDB tables, phpMyAdmin may say the engine does not support it. InnoDB usually fixes itself when MySQL restarts.

Method 3: WHM

WHM is the admin panel for server owners. You need a VPS or dedicated server with WHM.

  1. Log in to WHM as root.
    Screenshot: Log in to WHM as root.
  2. Search for Repair a MySQL Database in the search box on the left. The exact name can differ slightly between versions.
  3. Choose the database from the list.
  4. Click Repair Database.
    Screenshot: Click Repair Database .
    Screenshot: Click Repair Database .
    Screenshot: Click Repair Database .

Command line option

With SSH and root access, you can repair all databases at once:

Screenshot: With SSH and root access, you can repair all databases at once:
mysqlcheck -u root -p --auto-repair --all-databases

This checks every table and fixes the ones it can. It asks for the MySQL root password.

If repair does not work

Tip: Regular backups mean a damaged table never becomes a disaster.

Quick recap

  • Repair fixes damaged tables.
  • cPanel has Check Database and Repair Database.
  • phpMyAdmin has Repair table under With selected.
    Screenshot: phpMyAdmin has Repair table under With selected.
    Screenshot: phpMyAdmin has Repair table under With selected.
    Screenshot: phpMyAdmin has Repair table under With selected.
    Screenshot: phpMyAdmin has Repair table under With selected.
  • WHM and mysqlcheck work for the whole server.
  • Back up first, and restore if repair fails.