How to  Optimize Tables using Mysqlcheck

The following optimizes employee table that is located in ucartz database.

# mysqlcheck -o ucartz employee -u root -p
Enter password:
ucartz.employee         OK

Internally mysqlcheck command uses “OPTIMIZE TABLE” command. When you delete lot of rows from a table, optimizing it helps to get the unused space and defragment the data file. This might improve performance on huge tables that has gone through several updates.


 Repair Tables using Mysqlcheck

The following repairs employee table that is located in ucartz database.

# mysqlcheck -r ucartz employee -u root -p
Enter password:
ucartz.employee        OK

Internally mysqlcheck command uses “REPAIR TABLE” command. This will repair and fix a corrupted MyISAM and archive tables.

Was this answer helpful? 0 Users Found This Useful (0 Votes)