Myisamchk repair of corrupted MySQL database methods

Source: Internet
Author: User
Tags phpmyadmin

Method One, modify directly in command mode

1, Myisamchk

To fix the MySQL database, there is also a command: Mysqlcheck

Mysqlcheck-a-c-o-r–all-databases-uroot-p//This command is the best way to optimize all DB databases.

The meaning of the parameters is as follows:
-A = analyse given tables.
-c = Check table for errors
-O = Optimise table
-r = Can fix almost anything except unique keys that aren ' t unique

If it is under the win host, repair the specified table, using: Mysqlcheck-o-R database name-U root-p, in the Prompt input password box, enter the MySQL root management password, Mysqlcheck will be the database for detection and repair

Instance

The MySQL server must be temporarily stopped using MYISAMCHK. For example, we need to overhaul the Discuz database. Perform the following actions:
# service MySQL stop (stop MySQL);
# myisamchk-r/Database file absolute path/*myi
# service MySQL Start
Myisamchk automatically checks for and repairs index errors in the datasheet.

2, Mysqlcheck

With Mysqlcheck you do not need to stop MySQL for hot fixes. The procedure is as follows: # Mysqlcheck-r discuz.*

Note that, whether it is Myisamchk or mysqlcheck, do not normally use the-F force fix, the-f parameter deletes part of the error data to try to fix when the general fix fails to succeed

Method two, using phpMyAdmin to quickly modify the corrupted MySQL

1, Login phpMyAdmin, enter the phpMyAdmin data list page;

2, select a data table before the box;

3, below the page "selected item" Drop-down Select "Fix table";

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.