Considerations for using MySQL MyISAM tables

Source: Internet
Author: User

I. Summary of the causes of MyISAM Table Corruption in MySQL:

1. The data file is damaged due to a sudden power failure on the server. The MySQL service is forcibly shut down without being shut down first. The mysqld process is killed when writing a table.

2. the disk is damaged.

3. The server crashes.

4. MySQL bug.

Ii. Summary of symptoms of MyISAM Table Corruption in MySQL:

1. An error is returned when querying data: Incorrect key file for table: '...'. Try to repair it

2. the query cannot find rows in the table or return incomplete data.

3. Error: Table '...' is marked as crashed and shoshould be retried red.

4. failed to open the table: Can't open file: '×××. myi' (errno: 145 ).

Iii. Prevention of MyISAM Table Corruption in MySQL:

1. Check the MyISAM table regularly. You can use myisamchk, mysqlcheck, or check table.

2. After a large number of update or delete operations, use mysqlcheck or optimize table to optimize the table. This reduces file fragmentation and the probability of table corruption. 3. Shut down mysqld before shutting down the server (close the service normally, do not use kill-9 to kill the process ).

4. Use the UPS power to avoid sudden power failure.

5. Use the latest stable MySQL version to reduce table corruption caused by MySQL bugs.

6. Perform raid on the disk to reduce disk errors and improve performance.

7. It is best for the database server to run only mysqld and other necessary services. Do not run other services. This reduces the possibility of table corruption caused by crashes.

Iv. Repair Summary of MyISAM Table Corruption in MySQL:

1. If mysqld is down and cannot be started, you can use mysiamchk to fix it. This tool can be used when the mysqld service is not started. This tool can check and analyze and repair the MyISAM table.

2. If mysqld is still running, or you can restart it, you can fix it using the mysqlcheck tool. Alternatively, you can use MySQL's built-in repair SQL statement to fix: Check table, repair table, analyse table, and optimize table. These two methods can also achieve table repair. The two methods have their own application scenarios.

Related Article

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.