Repair.php v 0.2 Feb 3, 2002 To get repair run, just edit the $host, $user and $pass variables to fit your local settings. Then load the file via http in your browser. Below you find some information about repairing and optimizing MySQl tables. Read them thoroughly! The information is taken from the documentation for MySQL 3.23.33. Repair was tested with Apache 3.1.20 and MySQL 3.23.33 on a Win2kPro machine. If you encounter any abnormal errors, please first refer to the MySQL Documentation and Mailinglists before writing an E-mail to the author. If you feel like you needed to tell the author about your (solved) problem, don't hesitate to contact him. OPTIMIZE TABLE Syntax (taken from the MySQL Documentation http://www.mysql.com/) OPTIMIZE TABLE tbl_name[,tbl_name]... OPTIMIZE TABLE should be used if you have deleted a large part of a table or if you have made many changes to a table with variable-length rows (tables that have VARCHAR, BLOB, or TEXT columns). Deleted records are maintained in a linked list and subsequent INSERT operations reuse old record positions. You can use OPTIMIZE TABLE to reclaim the unused space and to defragment the data file. For the moment OPTIMIZE TABLE only works on MyISAM and BDB tables. For BDB tables, OPTIMIZE TABLE is currently mapped to ANALYZE TABLE. See section 7.15 ANALYZE TABLE Syntax. You can get optimize table to work on other table types by starting mysqld with --skip-new or --safe-mode, but in this case OPTIMIZE TABLE is just mapped to ALTER TABLE. OPTIMIZE TABLE works the following way: If the table has deleted or split rows, repair the table. If the index pages are not sorted, sort them. If the statistics are not up to date (and the repair couldn't be done by sorting the index), update them. OPTIMIZE TABLE for MyISAM tables is equvialent of running myisamchk --quick -- check-changed-tables --sort-index -- analyze on the table. Note that the table is locked during the time OPTIMIZE TABLE is running! REPAIR TABLE Syntax (taken from the MySQL Documentation http://www.mysql.com/) REPAIR TABLE tbl_name[,tbl_name...] [QUICK] [EXTENDED] REPAIR TABLE only works on MyISAM tables and is the same as running myisamchk - r table_name on the table. Repair the corrupted table. The command returns a table with the following columns: Column Value Table Table name Op Always ``repair'' Msg_type One of status, error, info or warning. Msg_text The message. Note that you can get many rows of information for each repaired table. The last one row will be of Msg_type status and should normally be OK. If you don't get OK, you should try repairing the table with myisamchk -o, as REPAIR TABLE does not yet implement all the options of myisamchk. In the near future, we will make it more flexible. If QUICK is given then MySQL will try to do a REPAIR of only the index tree. If you use EXTENDED then MySQL will create the index row by row instead of creating one index at a time with sorting; This may be better than sorting on fixed- length keys if you have long char() keys that compress very good. Changes: v 0.2 second release, HTML tables, repair and optimize v 0.1 first release, merely formatted output, only repair