10bet网址
MySQL 8.0 Reference Manual
Related Documentation Download this Manual Excerpts from this Manual

5.9.1.7 Making a Test Case If You Experience Table Corruption

The following procedure applies toMyISAMtables. For information about steps to take when encounteringInnoDBtable corruption, seeSection 1.6, “How to Report Bugs or Problems”.

If you encounter corruptedMyISAMtables or ifmysqldalways fails after some update statements, you can test whether the issue is reproducible by doing the following:

  1. 停止MySQL哒emon withmysqladmin shutdown.

  2. Make a backup of the tables to guard against the very unlikely case that the repair does something bad.

  3. Check all tables withmyisamchk -s database/*.MYI. Repair any corrupted tables withmyisamchk -r database/table.MYI.

  4. Make a second backup of the tables.

  5. Remove (or move away) any old log files from the MySQL data directory if you need more space.

  6. Startmysqldwith the binary log enabled. If you want to find a statement that crashesmysqld, you should start the server with the general query log enabled as well. SeeSection 5.4.3, “The General Query Log”, andSection 5.4.4, “The Binary Log”.

  7. When you have gotten a crashed table, stop themysqld服务器.

  8. Restore the backup.

  9. Restart themysqld服务器withoutthe binary log enabled.

  10. Re-execute the statements withmysqlbinlog binary-log-file | mysql. The binary log is saved in the MySQL database directory with the namehostname-bin.NNNNNN.

  11. If the tables are corrupted again or you can getmysqldto die with the above command, you have found a reproducible bug. FTP the tables and the binary log to our bugs database using the instructions given inSection 1.6, “How to Report Bugs or Problems”. If you are a support customer, you can use the MySQL Customer Support Center (https://www.mysql.com/support/) to alert the MySQL team about the problem and have it fixed as soon as possible.