Here are a variety of ways to collect online, you can test.
A
Browsing his blog last night, suddenly found that all the pages can not be displayed, in the background to view the time, found a "Table" XXX is marked as crashed and should be repaired "error. Hurriedly online search, the original modification of this serious error is simple:
1. Go to phpMyAdmin to manage MySQL
2. Select your own database on the left
3. Check the ' xxx ' table in the error message on the right
4. Scroll to the bottom of the screen, there is a drop-down menu (with selected:), select "Repair table"
After the modification, and did not find any data loss, hurriedly back up a copy of the database into the mail, backup is still very important!
Two
Phenomenon:
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 should be repaired
Mysql> exit
Use the command Myisamchk to repair the database's myi file
#/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
Three
caused by:java.sql.SQLException:Table ' table name ' is marked as crashed and should be repaired
Workaround:
The path to the./myisamchk-c-r database table Myi file (for example:/HOME/MYSQL/VAR/CRAWLERFEEDSKY/AAAA. MYI)
If not, then-F forced repair
Four
Today on the server A look, found that the page error, unable to connect to the database server. MySQL service itself down, and then restart the server, found that the Web page could not be opened, prompted: [Mysql]table Tblname is marked as crashed and should be repaired
MySQL prompt tblname table is corrupted and needs fixing, workaround:
Go to the corresponding database directory:
Cd/var/lib/mysql/dbname
Using Myisamchk Repair:
Shell> Myisamchk-r Tblname
Five
The repair command I used is: Myisamchk-r bbsthreads
Where Bbsthreads is the name of my problem, of course, use this command to enter the MySQL database you have problems with the table storage path, more detailed commands can see help: Myisamchk--help;
If you can not solve the problem with the above command, please look at the back, the following content is reproduced by me.
My site problems, visit a look, sure enough full screen error, check the MySQL log, the error message is:
Table '. \dedecmsv4\dede_archives ' is marked as crashed and should be repaired
Note that the CMS article table dede_archives is flagged with a problem and needs to be repaired. So hurry to restore historical data, the Internet to find reasons. Eventually the problem is solved. Here's how to fix it:
Locate the Bin/myisamchk tool for the MySQL installation directory and enter it at the command line:
Myisamchk-c-R. /data/dedecmsv4/dede_archives. MYI
Then the Myisamchk tool will help you recover the index of the data table. Restart MySQL for problem resolution.
Problem Analysis:
1, the cause of the error, the Netizen said is frequently query and update dede_archives table caused by the index error, because my page is not static generation, but dynamic page, so I agree with this argument. It is also said that the MySQL database for some reason has been damaged, such as: The database server burst power outage, in the database table provides services when the table's original file for some kind of operation may cause the MySQL database table is corrupted and unable to read the data. This is because some of the unpredictable problems caused the damage to the table.
The issue is numbered 145
2. Problem solving method.
When you try to fix a corrupted table, there are three types of repair. If you get an error message stating that a temporary file cannot be established, delete the file indicated by the information and try again-this is usually left over from the last repair operation.
The three repair 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 quickest, which is used to fix the most common problems, and the last is the slowest one to fix problems that other methods cannot fix.
Checking and repairing MySQL data files
If the above method cannot fix a damaged table, you can try these two techniques before you give up:
If you suspect the table's index file (*. MYI) An uncorrectable error has occurred, even if the file is lost, you can use the data file (*. MYD) and a data format file (*.FRM) to regenerate it. First make a copy of the data file (TBLNAME.MYD). To restart your MySQL service and connect to the service, use the following command to delete the contents of the table:
Mysql> DELETE from Tblname;
When you delete the contents of a table, a new index file is created. Quit logging in and close the service again, and then overwrite the new (empty) data file with the data file (tblname.myd) you just saved. Finally, using MYISAMCHK to perform a standard fix (the second method above), the index data is regenerated based on the contents of the table's data and the table's format file.
If your table's format file (TBLNAME.FRM) is missing or an uncorrectable error has occurred, but you know how to use the corresponding CREATE TABLE statement to regenerate the table, you can regenerate a new. frm file and your data file and index file ( If there is a problem with the index file, use the method above to reconstruct a new one). First make a copy of the data and index file, and then delete the original file (delete all the records about the table in the Data directory).
Start the MySQL service and create a new table using the original CREATE table file. The new. frm file should work correctly, but it's a good idea to perform a standard fix (the second method above).
3, Myisamchk tool Introduction (see the official MySQL manual)
You can use the Myisamchk utility to get information about database tables or to check, repair, and optimize them. Myisamchk applicable MyISAM table (corresponding. Tables for myi and. myd files).
To invoke the Myisamchk method:
Shell> myisamchk [options] tbl_name ...
Options specify what you want Myisamchk to do. They are described later. You can also get a list of options by calling Myisamchk--help.
Tbl_name is the database table that you want to check or repair. If you do not run Myisamchk somewhere in the database directory, you must specify the path to the database directory because Myisamchk does not know where your database is located. In fact, Myisamchk doesn't care if the file you're working on is in a database directory; You can copy the file that corresponds to the database table elsewhere and perform the recovery there.
If you want, you can name several tables with the MYISAMCHK command line. You can also name the index file by using the. MYI "suffix" to specify a table. It allows you to use the mode "*. MYI "Specifies all tables in a directory. For example, if you are in the database directory, you can check all the MyISAM tables under the directory:
Shell> Myisamchk *. MYI
If you are not in the database directory, you can check all the tables there by specifying the path to the directory:
Shell> myisamchk/path/to/database_dir/*. MYI
You can even check all the tables in all the databases by specifying a wildcard character for the path to the MySQL data directory:
Shell> myisamchk/path/to/datadir/*/*. MYI
The recommended way to quickly check all MyISAM tables is:
Shell> myisamchk--silent--fast/path/to/datadir/*/*. MYI
If you want to check all the MyISAM tables and fix any corrupted tables, you can use the following command:
shell> myisamchk--silent--force--fast--update-state \
-O key_buffer=64m-o sort_buffer=64m \
-O read_buffer=1m-o write_buffer=1m \
/path/to/datadir/*/*. MYI
This command assumes that you have free memory greater than 64MB. For more information about allocating memory with MYISAMCHK, see section 5.9, 5.5, "Myisamchk memory Usage".
When you run Myisamchk, you must make sure that other programs do not use tables. Otherwise, when you run Myisamchk, the following error message is displayed:
Warning:clients is using or haven ' t closed the table properly
This means that you are trying to check for a table that is being updated by another program (such as a mysqld server) that has not closed the file or has been terminated without properly closing the file.
If Mysqld is running, you must use flush tables to force empty any table modifications that are still in memory. When you run Myisamchk, you must make sure that other programs do not use tables. The easiest way to avoid this problem is to use check table instead of Myisamchk to examine the table
What if a database error occurs?