mysql database damage repair method (applicable to window and Linux systems)
Sometimes when visiting a website, you will be prompted with a mysql error:Table XXX is marked as crashed and should be rewritten. How to solve this problem when encountering this problem?
Here are the repair methods as follows:
1. Command line method:
If it is the window system [Start]--[Run], enter cmd Enter Enter, and enter the following command in the pop-up black box as appropriate:
(Linux system ssh is executed directly by logging in to the server)
1. Repair individual databases
mysqlcheck -r -u database username-p password database name
Example: mysqlcheck -r -udemo -p123456 demo
2. Repair all databases on the server
mysqlcheck -A -o -r -uroot -p password
This syntax will prompt a syntax error in versions above mysql5.5, and versions above mysql5.5 use mysqlcheck -A -r -uroot -pxxxx
Example: mysqlcheck -A -o -r -uroot -pxxxx
3. Automatic check optimization analysis table
mysqlcheck -Aao --auto-repair -uroot -p password
This syntax will prompt a syntax error in versions above mysql5.5, and versions above mysql5.5 use mysqlcheck -A --auto-repair -uroot -p password
4. Repair if the mysql system table is damaged and cannot be started.
Enter the following command on windows:
myisamchk -r -f D:wwwmysqldatamysql*.MYI
Enter the following command on the Linux system:
myisamchk -r -f /www/mysql/data/var/mysql/*.MYI
or
myisamchk -r -f /www/mysql/data/var/*/*.MYI
2. phpmyadmin method:
Visit http://localhost/phpmyadmin/in the server or log in to your own database, and click the database that needs to be repaired on the left. All tables in the database will be listed on the right side, select the damaged table or pull the page to the bottom, click Select All, and select Repair in the drop-down box.

© Website copyright and disclaimer
1.[honmau Media] independently owns the copyright of all materials on relevant pages of this website;
2. No one is allowed to copy it without the express written permission of [honmau Media];
3. The articles that do not indicate "honmau Media" on this website are all from the Internet and are only for everyone to learn and refer;
4. If there is any infringement/violation/irregularity, please contact customer service QQ or email to delete it, please understand;
5.[honmau Media] reserves the right to correct, modify and update this statement at any time.legal notice