MySQL Table repair and optimization

Source: Internet
Author: User

In many Linux production servers often use the database is MySQL, in the database is a lightweight database, but the use of a long time there are always some problems, the general situation is unable to read the table, at this time we will repair the table, optimize the table, reduce disk usage, to facilitate database backup.

When you enter MySQL with the root user, enter the library where the table is located

REPAIR table ' table_name ' Fix tables OPTIMIZE table ' table_name ' optimization tables

REPAIR table is used for repairing tables, while optimize table is used to reclaim unused database space, and when data rows on the table are deleted, the disk space occupied is not immediately reclaimed, and the space is reclaimed after using the Optimize Table command. And the data rows on the disk are re-queued. Optimize table is not necessarily run in many cases, as long as the batch is deleted, or a regular, such as once a week or one months to optimize the table to reduce the table data occupy disk space. Of course, in the process of repair also pay attention to the MySQL table file table_name.frm file attributes, because sometimes in the compiled version of MySQL does not have init.d in the startup script, is the MySQL under the bin directory under the Mysqld_safe tool launched, Sometimes if you do not specify the startup user or start the user is not the MySQL software used by the user startup, MySQL table file will be a problem, there will be unreadable files and so on a series of problems, so, in some cases we also use Chown to modify the MySQL table file permissions to achieve repair.

This article is from the "Technical essay" blog, please be sure to keep this source http://jim123.blog.51cto.com/4763600/1831996

MySQL Table repair and optimization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.