If your website has slowed down over time, or you're seeing a database-related error on a WordPress or custom PHP site, the cause is often a database table that has built up unused overhead or become corrupted. You can fix both problems yourself using phpMyAdmin, the database management tool included with your hosting account. The steps below are the same whether you're on cPanel or DirectAdmin.
When You Need to Optimize or Repair a Database
Consider running these steps if you notice any of the following:
- Pages that query the database (product listings, search results, admin dashboards) load noticeably slower than before.
- Your website shows an error mentioning a "crashed" or corrupted table.
- You've just finished a bulk delete or import, for example clearing old orders or spam comments, and want to reclaim the space it left behind.
Optimizing and repairing tables is safe in almost all cases, but if the site is business-critical, take a quick backup first. See How to Back Up a Single MySQL Database.
How to Access phpMyAdmin
- Log in to your control panel (cPanel or DirectAdmin).
- Find and click phpMyAdmin under the Databases section.
- In the left sidebar, click the name of the database you want to work on.
How to Repair a Database Table
Use this when a table has become corrupted, usually after an interrupted import, an unexpected server restart, or a plugin conflict.
- With your database open, tick the checkbox next to the table (or tables) you want to repair. To select all of them, tick the checkbox at the bottom of the table list.
- Open the With selected dropdown near the bottom of the page.
- Click Repair table.
- phpMyAdmin will show a status message for each table confirming the repair.
How to Optimize a Database Table
Optimizing reclaims unused space and rebuilds indexes, which can speed up queries on tables that see a lot of updates and deletes.
- Tick the checkbox next to the table (or tables) you want to optimize.
- Open the With selected dropdown.
- Click Optimize table.
- phpMyAdmin will confirm the operation once it's complete.
Checking a Single Table First
If you only suspect one table is the problem, click that table's name, then open the Operations tab. You'll find a Repair table button there, along with a table maintenance section that includes an Optimize table option, so you don't have to select it from the full database list.
Note: on tables using the InnoDB storage engine (the default for most modern WordPress and PHP applications), "repair" is rarely needed since InnoDB recovers automatically after a restart. Optimizing still works the same way regardless of storage engine.
If a table still won't repair after trying this, the underlying data may be more seriously damaged. Contact ZIPROF support with the exact error message so it can be investigated at the server level.