MyISAM is the main, or rather, one of the main (along with InnoDB) storage systems in the MySQL DBMS. At the same time MyISAM tables are damaged very simply - there are no problems with this. It is more difficult to repair all damage, although this can also be done fairly quickly. This article explains how to solve the problem using myisamchk to identify the problem with MyISAM and fix it.undef error - DBD::mysql::db selectrow_array failed: Table 'attach_data' is marked as crashed and should be repaired [for Statement "SELECT LENGTH(thedata) FROM attach_data WHERE id = ?"] at Bugzilla/Attachment.pm line 344 Bugzilla::Attachment::datasize('Bugzilla::Attachment=HASH(0x9df119c)') called # myisamchk /var/lib/mysql/bugs/*.MYI >> /tmp/myisamchk_log.txt myisamchk: error: Wrong bytesec: 0-0-0 at linkstart: 18361936 MyISAM-table 'attach_data.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 'groups.MYI' is usable but should be fixed myisamchk: warning: 1 client is using or hasn't closed the table properly MyISAM-table 'profiles.MYI' is usable but should be fixed Checking MyISAM file: user_group_map.MYI Data records: 182 Deleted blocks: 0 - check file-size - check record delete-chain - check key delete-chain - check index reference - check data record references index: 1 # myisamchk -r profiles.MYI - recovering (with sort) MyISAM-table 'profiles.MYI' Data records: 80 - Fixing index 1 - Fixing index 2 # myisamchk --silent --force --fast --update-state /var/lib/mysql/bugs/*.MYI myisamchk: MyISAM file /var/lib/mysql/bugs/groups.MYI myisamchk: warning: 1 client is using or hasn't closed the table properly myisamchk: MyISAM file /var/lib/mysql/bugs/profiles.MYI myisamchk: warning: 1 client is using or hasn't closed the table properly # 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/bugs/*.MYI # 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 18:46:59 Status: open,changed,analyzed,optimized keys,sorted index pages Auto increment key: 1 Last value: 88 Data 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: 4398046510079 Recordlength: 2124 table description: Key Start Len Index Type Rec/key Root Blocksize 1 2 3 unique int24 1 1024 1024 2 5 765 unique char packed stripped 1 2048 4096 Field Start Length Nullpos Nullbit Type 1 1 1 2 2 3 no zeros 3 5 765 no endspace Source: https://habr.com/ru/post/257291/
All Articles