Troubleshoot MySQL Table ' * * * * marked as crashed and should be repaired issues

Source: Internet
Author: User

Yesterday when the backend program read the database information, the Log Report related data table can not read and write data, into the MySQL database found table './wordpress/wp_posts ' is marked as crashed and should be repaired Error because the data table in the Qqtexas is corrupted, so the data cannot be read:

# mysql-u Root-penter password:mysql> use Qqtexas; Reading table information for completion of table and column namesyou can turn off this feature to get a quicker startup W Ith-adatabase changedmysql> SELECT * from Wp_posts; ERROR 145 (HY000): Table './wordpress/wp_posts ' is marked as crashed and should be repairedmysql> quit

Method One:

Fix MySQL Database data table problem can be solved by Mysqlcheck, first with Mysqlcheck to look at:

# mysqlcheck-u root-p qqtexasenter Password:

Then add the--auto-repair parameter automatic repair, preferably before repairing backup database:

# mysqldump -u root -p qqtexas > qqtexas.sqlenter password:#  Mysqlcheck -u root -p qqtexas --auto-repairenter password:wordpress.wp_term_ taxonomyerror    : table upgrade required. please do  "REPAIR  TABLE  ' wp_term_taxonomy ' " or dump/reload to fix it!wordpress.wp_termserror     : Table upgrade required. Please do  "repair table   ' Wp_terms '  or dump/reload to fix it!wordpress.wp_usermetaerror     : Table upgrade required. Please do  "repair table  ' Wp_ Usermeta ' " OR DUMP/RELOAD TO FIX IT!WORDPRESS.WP_USERSERROR    :  Table upgrade required. Please do  "repair table  ' wp_users '"  or  dump/reload to fix it! repairing tablesqqtexas.wp_commentmeta                        OKqqtexas.wp_comments                            OKqqtexas.wp_links                               OKqqtexas.wp_options                            okqqtexas.wp_postmeta                            ok

For security reasons, the following two methods are not recommended for use in a production environment
#mysqlcheck-A-o-r-p//check to optimize and repair all databases
#mysqlcheck-A-o-r database name-p//repair the specified database


Parameter implication:
-A = analyse given tables. Analysis Data Sheet
-c = Check table for errors//check database for errors (corrupted) tables
-O = optimise table//optimized data table
-r = Can fix almost anything except unique keys that aren ' t unique//repair corrupted data table
-M =–medium-check



Method Two:

Repairing a database's myi file using the command Myisamchk

[Email protected] ~]# myisamchk-c-r/usr/local/mysql/data/qqtexas/zt_action. Myi-recovering (with sort) myisam-table '/usr/local/mysql/data/qqtexas/zt_action. MYI ' Data records:21810-fixing index 1-fixing index 2

If this does not work, use-f to enforce the fix;

Myisamchk-c-r-f/usr/local/mysql/data/qqtexas/zt_action. MYI



Mysqlcheck Description:
The Mysqlcheck client can examine and repair the MyISAM table. It can also optimize and analyze tables.

The Mysqlcheck function is similar to MYISAMCHK, but its work is different. The main difference is that when the MYSQLD server is running, Mysqlcheck must be used, and myisamchk is applied to the service

The service does not run. The advantage of using Mysqlcheck is that you do not need to stop the server to check or repair the table. Failure to use MYISAMCHK repair is irreversible.

Mysqlcheck provides a convenient way for users to check table, REPAIR table, ANALYZE table, and optimize table using SQL statements. It determines

Use which statement is used in the action you want to perform, and then send the statement to the server you want to execute.

Reference: http://www.vpsee.com/

Http://www.cnblogs.com/zhoujinyi/archive/2013/05/10/3070667.html

Http://www.javatang.com/archives/category/database

This article is from the "Start from the Heart" blog, please be sure to keep this source http://hao360.blog.51cto.com/5820068/1636856

Troubleshoot MySQL Table ' * * * * marked as crashed and should be repaired issues

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.