Question regarding the mysql databases function within cpanel 11

bbad

Registered
Jan 22, 2011
1
0
51
All,

I have recently become an administrator of a forum in which Cpanel is the method of access for maintenance functions. I see cpanel 11 has a "MySQL databases" function. When I select that it then takes me into a page where one of the options is to "Check" and another is to "Repair" the database.

The question I have is; If I execute these two options against our production database, does it also execute an Optimize of the individual mysql database tables? If not, no problem, I'll just access the db through the "MyPHPAdmin" functionality and then select the individual tables and then optimize them.

One more question, if I have to do this manually through the "MyPHPAdmin" menu, what is the preferred order? Should I first a.) Analyze b.) Check c.) Repair d.) Optimize?

Any input would be greatly appreciated!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello,

The mysqlcheck option has 4 functions it can perform:

- check
- repair
- optimize
- analyze

The MySQL commands to result in each of the above are these:

mysqlcheck databasename ==> checks the database (default behavior for mysqlcheck is to check the database(s))
mysqlcheck --repair databasename ==> repairs the database
mysqlcheck --optimize databasename ==> optimizes the database
mysqlcheck --analyze databasename ==> analyzes the database

The cPanel > MySQL Databases area has the option to check and repair databases. It does not perform MySQL database optimization or analysis.

The order you've listed is likely the best, since analyzing the database tells you if it is up-to-date or not. If it is, you can check check if it is okay, repair it and optimize it. Of note, if you have root SSH access, you could run the check, auto-repair and optimize at the same time. I typically use the following command in root SSH on all databases upon ensuring I have a full backup of them beforehand:

Code:
mysqlcheck -u root -p --auto-repair --check --optimize --all-databases
Thanks!