Knowledge Base

How to optimize and repair MySQL databases using phpMyAdmin

This article describes how to optimize and repair MySQL databases using phpMyAdmin.

Optimizing MySQL databases

Databases have the potential to grow very large, particularly on sites that receive a lot of traffic or have a large amount of content. In such cases, periodic database optimization may help improve web site performance.

To optimize a MySQL database, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. In the Databases section of the cPanel home screen, click phpMyAdmin. The phpMyAdmin administration page appears in a new window.
  3. In the left pane, click the name of the database that you want to optimize. For example, the following image shows the example_wordpress database selected:

    phpMyAdmin - left pane

  4. In the right pane, select the check boxes for the tables in the database that you want to optimize.

    To select all of the tables at once, select the Check All check box.

    phpMyAdmin - main pane

  5. In the With selected list box, select Optimize table. phpMyAdmin informs you whether or not the optimization process is successful.

Repairing MySQL databases

Databases can become corrupted for any number of reasons, from software defects to hardware issues. If this occurs, you can try to repair database tables using phpMyAdmin.

To repair MySQL database tables, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. In the Databases section of the cPanel home screen, click phpMyAdmin. The phpMyAdmin administration page appears in a new window.
  3. In the left pane, click the name of the database that you want to work on. For example, the following image shows the example_wordpress database selected:

    phpMyAdmin - left pane

  4. In the right pane, select the check boxes for the tables in the database that you want to repair.

    To select all of the tables at once, select the Check All check box.

    phpMyAdmin - main pane

  5. In the With selected list box, select Repair table. phpMyAdmin informs you whether or not the repair process is successful.

More Information

What is phpMyAdmin?

phpMyAdmin is a PHP-based, easy to use solution for the administration of MySQL and MariaDB databases. It is an extremely mature software option getting its start back in September 1998.

phpMyAdmin Database Management Features

phpMyAdmin is loaded with a number of features that have helped it grow into one of the most popular database administration tools available today. Just some of these tools includes:

  • User-friendly interface makes it particularly easy to manage your databases
  • Allows for both the management of your MySQL and MariaDB databases
  • The option to import your data from both SQL and CSV formats
  • Option to export your data from numerous formats including CSV, SQL, PDF, XML, Word, Excel and many more
  • The ability to administer multiple servers at once
  • Build PDF graphics of the layout of your database
  • The options to either search a subset of your database or perform a global search
  • Change the data you have stored into any format of your choosing through the use of predefined functions
  • View real time activity charts for the monitoring of your MySQL server including CPU/RAM use, server processes and connections
  • phpMyAdmin is compatible with a number of different operating systems

How phpMyAdmin Got Its Start

phpMyAdmin was created in September 1998 by IT consultant Tobias Ratschiller as a means to make database management easier. He appreciated a similar project called MySQL-Webadmin, but looked to improve on a few of its shortcomings and features it lacked. Ratschiller was successful in creating a better database management solution, evident by the fact that it was quickly adopted by users. However, Ratschiller had to abandon working on phpMyAdmin in 2000 simply because he didn't have the time to appropriately attend to it. His last release was made in June of that same year. Not long after, the trio of developers Loic Chapeaux, Marc Delisle and Olivier Muller were able to pick up where Ratschiller left off. Since their first release of phpMyAdmin in August 2001, the work of the three developers has helped phpMyAdmin continue to thrive and pick up steam.

phpMyAdmin Database Management Options

With all the powerful features included within phpMyAdmin, it's easy to forget that its designed to make it easier to manage your MariaDB and MySQL databases. Here are the ways phpMyAdmin makes it possible to do just that:

  • Browse Tables – You can view all tables that have existing records with a click of the browse button. From there you'll see a comprehensive list of the table's records.
  • Table Structure – Click the button to view a list of the table's field names, attributes, types, collations and just about anything else you could want to know.
  • Add Information – Click the Insert button within your phpMyAdmin install to insert records within your database.
  • Search Function – Easily find any information you're looking for within a specific table.
  • Drop – Use this functionality to remove an entire table as well as any records that it contains.
  • Remove Data – Similar to the drop button, the Empty button gives you the ability to remove data while still keep the newly empty table.