Data loss caused by repair table

Source: Internet
Author: User
Tags mysql manual

On the local test machine the day before yesterday, data loss occurs when MySQL 5.1.43 and MyISAM engines run repair table. We hereby record that the same problem has been encountered in MySQL 5.0.32, therefore, you must back up the data before repair table.

The night before executing repair table, I just watched the movie "astronaut's wife". Although it was a bad film, I was very impressed with one sentence: "The Space Agency told me, there must be backups. "outsiders know the simple truth, but I didn't do it. Remember this.

This is also a bug officially recognized by MySQL,

Http://bugs.mysql.com/bug.php? Id = 1, 10437,

Http://bugs.mysql.com/bug.php? Id = 1804

MySQL Manual also pointed out:

Mysql5.0 and mysql5.1,

How can we avoid the same problem?

UseMyisamchk
-- Safe-recover

Another cool-man recommended me: optimize local table tablename. The benefit of this command is that it works for both MyISAM and InnoDB.

After testing that the MyISAM table is damaged, optimize local table tablename cannot be repaired or usedMyisamchk
-- Safe-recover
Of course, do not forget the backup!

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.