# Optimizing and repairing MySQL databases using phpMyAdmin

> Use phpMyAdmin in cPanel to optimise slow MySQL tables and repair corrupted ones.

Source: https://helpcenter.ruachost.com/cpanel/databases/optimizing-and-repairing-mysql-databases-using-phpmyadmin/

Over time, MySQL databases can grow large or become corrupted due to heavy traffic, software bugs, or hardware issues. Using **phpMyAdmin** in cPanel, you can easily optimize and repair tables to improve performance and restore functionality.

## What Is phpMyAdmin?

- A **PHP‑based web application** for managing MySQL and MariaDB databases.
- Provides a **user‑friendly interface** for database administration.
- Supports importing/exporting data, searching, editing, and monitoring.

## Optimizing Databases

Optimization reorganizes table data and indexes to improve query performance.

### Steps

1. Log in to **cPanel**.
2. Go to **Databases → phpMyAdmin**.
3. In the left pane, select the database (e.g., `example_wordpress`).
4. In the right pane, check the boxes for tables you want to optimize.

   - To select all tables → click **Check All**.
5. From the **With selected** dropdown, choose **Optimize table**.
6. phpMyAdmin will confirm whether optimization was successful.

## Repairing Databases

Repairing fixes corrupted tables caused by crashes, bugs, or hardware issues.

### Steps

1. Log in to **cPanel → phpMyAdmin**.
2. Select the database in the left pane.
3. In the right pane, check the boxes for tables to repair.

   - To select all tables → click **Check All**.
4. From the **With selected** dropdown, choose **Repair table**.
5. phpMyAdmin will confirm whether the repair was successful.

## Additional Features of phpMyAdmin

- Browse tables and view records.
- Modify table structure (fields, types, collations).
- Insert, search, or delete records.
- Export/import data in multiple formats (CSV, SQL, XML, PDF, Word, Excel).
- Monitor server activity (CPU/RAM usage, processes, connections).
- Administer multiple servers at once.

> **Note:**
- Always **back up your database** before optimizing or repairing.
- Optimization is safe and can be run periodically for performance.
- Repair should be used only when corruption is suspected.
