Instance
The code is as follows |
Copy Code |
#locate Myisamchk #ln-S/usr/local/mysql/bin/myisamchk/usr/bin/myisamchk #myisamchk TableName. Myi #myisamchk-R-Q tablename |
If-R does not use the enforcement command as follows
The code is as follows |
Copy Code |
#myisamchk-R-o-f |
Well, based on the above, let's share an example.
MyISAM is a preset storage engine for MySQL. MyISAM table is very easy to rot away (corrupted).
This article will teach you how to check/repair camel Wu ├ Mary hygiene yisam tables.
Every time you make a table in MySQL DB, you will create a *.frm, * at the same time on the file system. MyD, with *. MYI, etc. three file formats.
*.frm = used to store data table style (file to store table format)
*. MyD (MyData) = for storing data (file to store data)
*. Myi (Myindex) = used to store indexes (file to store index)
How do I check db? which table needs fixing? Stop?/p>
Use ROOT to execute the following instructions, assuming that you want to check each table under DB1
The code is as follows |
Copy Code |
#myisamchk/var/lib/mysql/db1/*. Myi >> /tmp/myisamchk.log |
In the screen output, if the following words are found, the table should be repaired. /p>
The code is as follows |
Copy Code |
Myisamchk:error:Keypointers and record positions doesn ' t match Myisam-table '/var/lib/mysql/db1/news_post_comment. Myi ' is corrupted Fix it using switch "-r" or "O" Myisamchk:warning:1 client is using or hasn ' t closed the table properly Myisam-table '/var/lib/mysql/db1/news_post. Myi ' is usable but should to be fixed Myisamchk:warning:1 client is using or hasn ' t closed the table properly Myisam-table '/var/lib/mysql/db1/news_post_push_log. Myi ' is usable but should to be fixed |
More information will be displayed in the redirect file. As follows
The code is as follows |
Copy Code |
Checking MyISAM file:/var/lib/mysql/db1/yam_bbauth. Myi Data records:14 Deleted blocks:0 -Check File-size -Check record Delete-chain -Check Key Delete-chain -Check Index Reference -Check data record references Index:1 -Check Record links |
How to use Myisamchk Maro hygiene? Ables:
After you find the rotten table, use the following instructions to fix it. Stop?/p>
The code is as follows |
Copy Code |
#myisamchk –r/var/lib/mysql/db1/news_post_comment. Myi -Recovering (with sort) myisam-table '/var/lib/mysql/db1/news_post_comment. Myi Data records:1 -Fixing Index 1 |
If a table is being used by a application, you may see that the clients are using or haven ' t closed the table properly.
So it is suggested that the ysqld turn off or lock tables with flush tables to prevent the modification of the DB table by pplication.
How to?/p> the inspection and repair of the school
code is as follows |
copy code |
# Myisamchk--silent--force--fast--update-state/var/lib/mysql/db1/*. Myi Myisamchk:myisam file/var/lib/mysql/db1/groups. Myi Myisamchk:warning:1 Client is using or hasn ' t closed the table properly Myisamchk:myisam file/var/lib/mysq L/db1/profiles. Myi Myisamchk:warning:1 Client is using or hasn ' t closed the table properly |
The meaning of options is as follows:
? S,–silent option:prints only errors. can use Two-s to make myisamchk very silent.
? -f,–force Option:restart Myisamchk automatically with repair option-r, if there are all errors in the table.
? -f,–fast Option:check only tables that haven ' t been closed properly.
? -u–update-state option:marks tables as crashed, when it finds any error.
Innocent and Shabu ning? Yo eel with? B
Large table, repair, 艹 silky neon Huan p. Strider pupa and rinse coinage Q?? /p>
The code is as follows |
Copy Code |
# myisamchk--silent--force--fast--update-state--key_buffer_size=512m--sort_buffer_size=512m --read_buffer_size=4m--write_buffer_size=4m/var/lib/mysql/db1/*. Myi
|
Get table information with Myisamchk
The code is as follows |
Copy Code |
# MYISAMCHK-DVV profiles. Myi MyISAM file:profiles. Myi Record format:packed Character set:latin1_swedish_ci (8) File-version:1 Creation time:2007-08-16 1 8:46:59 status:open,changed,analyzed,optimized keys,sorted index pages Auto increment key:1 last value:88 D ATA records:88 Deleted blocks:0 datafile parts:118 Deleted data:0 datafile Pointer (bytes): 4 keyfile pointer (bytes): 4 datafile length:6292 keyfile length:6144 Max datafile length:4294967294 Max keyfile length:43980465 10079 recordlength:2124 Table Description: Key Start Len Index Type rec/key Root Blocksize 1 2 3 Uniqu E Int24 1 1024 1024 2 5 765 Unique char packed stripped 1 2048 4096 Field Start Length nullpos nullbit Type |