Table 'xxx' is marked as crashed and shoshould be retried red error solution reference

Source: Internet
Author: User

Or any of these methods can be applied to the database. I do not have a conditional test. If I have a conditional test, it is expected to solve the problem that the database reports this error.
Preventive measures:
1. Make sure to back up the database once. At least the table structure is retained, and some data is dispensable and can be directly overwritten.
2. Pay attention to backup of important data, usually once every month.
3. The following methods are feasible after jb51.net testing.

Copy codeThe Code is as follows: solution: first, locate the directory containing the myisamchk.exe file in your mysqldirectory.
./Myisamchk-c-r database table MYI file path (for example,/home/mysql/var/crawlerfeedsky/aaaa. MYI)
If not, force-f to fix it.

How to fix mysql on a windows Server:
F: \ sqldata \ mysql \ bin> cd .. the parent directory is returned.
F: \ sqldata \ mysql> cd data enter the database directory (mysql database files are stored in the data directory)
F: \ sqldata \ mysql \ data> cd jb51 enter the database. In windows server, the database is a folder (jb51 is used as an example here)

F: \ sqldata \ mysql \ data \ jb51> myisamchk-r jb51_soft

-Recovering (with sort) MyISAM-table 'jb51 _ soft'
Data records 7216
-Fixing index 1
-Fixing index 2
-Fixing index 3

F: \ sqldata \ mysql \ data \ jb51>

Jb51_soft is the name of the database table. If any table error is prompted, the table is fixed.

For future convenience, we can write a batch process and save the file as fixit. bat to the directory where the database is located.Copy codeThe Code is as follows: myisamchk-r jb51_soft

The following are various methods for online collection. You can test them.
(1)
When I browsed my Blog last night, I suddenly found that all the pages could not be displayed. When I checked it in the background, an error "Table 'xxx' is marked as crashed and shocould be retried red" is found. Quickly search the Internet. It was easy to modify this serious error:
1. Go to phpmyadmin to manage mysql
2. Select your database on the left.
3. Check the 'xxx' table in the error message on the right.
4. Scroll down the screen to the bottom. There is a drop-down menu (With selected :) and select "Repair table"
After the modification, no data loss was found, and a database was quickly backed up to the email, which is still very important!
(2)
Symptom:
Mysql> use yourealcn
Database changed
Mysql> select user, company from biz_user where commend = '1' order by regtime desc, checked desc limit 0, 5;
ERROR 145 (HY000): Table './yourealcn/biz_user' is marked as crashed and shoshould be retried red
Mysql> exit
Run the myisamchk command to restore the MYI file of the database.
#/Usr/local/mysql5/bin/myisamchk-c-r/bak/lib/mysql/yourealcn/biz_user .*
Myisamchk: error: '/bak/lib/mysql/yourealcn/biz_user.frm' is not a MyISAM-table
---------
Myisamchk: error: '/bak/lib/mysql/yourealcn/biz_user.myd' is not a MyISAM-table
---------
-Recovering (with sort) MyISAM-table '/bak/lib/mysql/yourealcn/biz_user.myi'
Data records 20414
-Fixing index 1
-Fixing index 2
-Fixing index 3
-Fixing index 4
(3)
Caused by: java. SQL. SQLException: Table 'table name' is marked as crashed and shoshould be retried red
Solution:
./Myisamchk-c-r database table MYI file path (for example,/home/mysql/var/crawlerfeedsky/aaaa. MYI)
If not, force-f to fix it.
(4)
I checked it on the server today and found a webpage error. I cannot connect to the database server. After the mysql service is down, restart the server and find that the webpage cannot be opened. The prompt is [mysql] Table tblName is marked as crashed and shoshould be retried red.
Mysql prompts that the tblName table is corrupted and needs to be repaired. solution:
Enter the corresponding database directory:
Cd/var/lib/mysql/dbname
Use myisamchk to fix the problem:
Shell> myisamchk-r tblName
(5)
The fix command I used is myisamchk-r bbsthreads.
Among them, bbsthreads is the name of the table with a problem. Of course, you have to use this command to enter the storage path of the table in the database with a problem in mysql. For more detailed commands, see help: myisamchk -- help;
If you cannot solve the problem by using the above command, please refer to the following content.
My website has a problem. When I access the website, an error is displayed in full screen. Check the mysql Log. The error message is:
Table '. \ dedecmsv4 \ dede_archives' is marked as crashed and shoshould be retried red
It indicates that the dede_archives table of cms is marked with a problem and needs to be fixed. As a result, the system quickly restored historical data and went online to find the cause. Finally, the problem is solved. The solution is as follows:
Find the bin/myisamchk tool in the mysql installation directory, and enter:
Myisamchk-c-r ../data/dedecmsv4/dede_archives.MYI
Then the myisamchk tool will help you restore the index of the data table. Restart mysql to solve the problem.
Problem Analysis:
1. Cause of the Error. Some netizens say that the index error is caused by frequent queries and updates to the dedede_archives table. Because my page is not generated statically but is a dynamic page, I agree with this statement. It is also said that the MYSQL database is damaged for some reason, such: sudden Power outages on the database server and operations on the table's original files when providing services on the database table may cause damage to the MYSQL database table and the data cannot be read. In short, the table is damaged due to some unpredictable problems.
The problem number is 145.
2. Solutions.
There are three repair types when you try to fix a broken table. If you get an error message indicating that a temporary file cannot be created, delete the file indicated by the Information and try again-this is typically left behind by the last repair operation.
The three methods are as follows:
% Myisamchk -- recover -- quick/path/to/tblName
% Myisamchk -- recover/path/to/tblName
% Myisamchk -- safe-recover/path/to/tblName
The first is the fastest, which is used to fix the most common problems, and the last is the slowest, which is used to fix problems that cannot be fixed by other methods.
Check and repair MySQL Data Files
If the above method cannot repair a damaged table, you can try the following two tips before giving up:
If you suspect that the index file of the table (*. MYI) an irreparable error occurs, or even this file is lost. You can use the data file (*. MYD) and Data Format File (*. frm. Create a copy of the data file (tblName. MYD. Restart your MySQL service and connect to the service. Run the following command to delete the table content:
Mysql> delete from tblName;
When deleting the table content, a new index file is created. Log out and close the service again, and overwrite the new (empty) data file with the data file (tblName. MYD) You just saved. Finally, use myisamchk to execute the standard repair (the second method above) and regenerate the index data based on the table data content and the table format file.
If your table format file (tblName. frm) is lost or an irreparable error occurs, but you know how to use the corresponding create table statement to regenerate the TABLE, you can regenerate a new one. frm files are used together with your data files and index files (if there is a problem with the index file, use the above method to recreate a new one. Create a copy of the data and index file, and then delete the original file (delete all records related to the table in the data directory ).
Start MySQL and use the original create table file to CREATE a new TABLE. The new. frm file should work properly, but you 'd better execute the Standard fix (the second method above ).
3. myisamchk tool Introduction (see the mysql official manual)
You can use the myisamchk utility to obtain information about database tables or to check, repair, and optimize them. Myisamchk applies to MyISAM tables (tables corresponding to. MYI and. MYD files ).
Call the myisamchk method:
Shell> myisamchk [options] tbl_name...
Options specifies what you want myisamchk to do. Describe them later. You can also obtain the Option List by calling myisamchk -- help.
Tbl_name is the database table you want to check or repair. If you do not run myisamchk somewhere in the database directory, you must specify the path of the database directory because myisamchk does not know where your database is located. In fact, myisamchk does not care whether the file you are operating on is in a database directory; you can copy the file corresponding to the database table to another place and perform restoration operations there.
If you want to, you can use the myisamchk command line to name several tables. You can also specify a table by naming the index file (with the suffix ". MYI. It allows you to specify all tables in a directory by using the "*. MYI" mode. For example, if you are in the database directory, you can check all MyISAM tables in the directory as follows:
Shell> myisamchk *. MYI
If you are not in the database directory, you can check all the tables in the directory by specifying the path:
Shell> myisamchk/path/to/database_dir/*. MYI
You can even specify a wildcard for the path of the MySQL data directory to check all tables in all databases:
Shell> myisamchk/path/to/datadir/*. MYI
We recommend that you quickly check all MyISAM tables:
Shell> myisamchk -- silent -- fast/path/to/datadir/*. MYI
To check all MyISAM tables and repair any damaged tables, run the following command:
Shell> myisamchk -- silent -- force -- fast -- update-state \
-O key_buffer = 64 M-O sort_buffer = 64 M \
-O read_buffer = 1 M-O write_buffer = 1 M \
/Path/to/datadir/*. MYI
This command assumes that you have a free memory larger than 64 MB. For more information, see section 5.9.5.5 "myisamchk memory usage ".
When running myisamchk, make sure other programs do not use tables. Otherwise, the following error message is displayed when you run myisamchk:
Warning: clients are using or haven't closed the table properly
This indicates that you are trying to check the table that is being updated by another program that has not closed the file or has been terminated but has not properly closed the file (for example, mysqld server.
If mysqld is running, you must use flush tables to forcibly clear any table that is still in memory for modification. When running myisamchk, make sure other programs do not use tables. The easiest way to avoid this problem is to use check table instead of myisamchk.

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.