MySQL table marked as broken

I am new to MySQL database. I repeatedly see an error from MySQL saying that the table is marked as broken and needs to be fixed. However, I can restore a broken table using the myisamchk command. By the way, I use MySQL MySQL in MySQL.

I just wanted to know under what circumstances a column of a DB table and how can I prevent it from repeating?

I am connecting to a MySQL (5.0) database from a Tcl (8.5) script using the mysqltcl (3.0) library.

+6
source share
1 answer

MyISAM tables are very easily destroyed. Each table has header information that tracks how many open files the MyISAM table processes.

If mysqld crashes, any MyISAM table that had open file descriptors has never been able to reduce the number of file descriptors each time the file descriptor is closed. Thus, if a new file descriptor opens the MyISAM table (.MYD file), and mysqld detects a mismatch between the number of file processes, the MyISAM table is considered open, and the number of files processed by the MyISAM table is actually open, the table is declared broken.

There are four (4) methods for doing this:

METHOD # 1: Setting up automatic recovery of MyISAM

See my post https://dba.stackexchange.com/a/15079/877 on how to install this when rebooting MySQL (March 15, 2012)

METHOD # 2: use InnoDB instead of MyISAM

InnoDB has disaster recovery built into Engine Engine initialization. Myisam not

METHOD # 3: Use Aria instead of MyISAM

Aria - MyDam replacement for MariaDB replacement. It implements crash recovery mechanisms for individual tables.

METHOD # 4: Do not kill -9 on mysqld

If mysqld crashes, inadvertently, the header information for all open MyISAM tables will cause them to crash. Avoid manually killing mysqld.

+9
source

Source: https://habr.com/ru/post/922384/


All Articles