Mysql storage engine MyISAM FAQ (Table Corruption, inaccessible, insufficient disk space), mysqlmyisam
This article describes how to solve the MyISAM FAQ of the Mysql storage engine for your reference. The specific content is as follows:
I. Dealing with Table Corruption of the MyISAM storage engine
When using MySQL, The MyISAM storage engine table may be damaged. For example:
. Frm locked and cannot be modified
The. myi file (index file) is not found)
Unexpected end records
File destroyed
Error nnn obtained from table Processor
Solution 1:
Use the myisamchk tool provided by MySQL to fix the problem.
Open the bin directory and you can see the tool
The command is as follows:
Myisamchk-r tablename
R stands for recover
Or
Myisamchk-o tablename
-O parameter represents-safe-recover for more secure repair
Solution 2:
Use the CHECK table and repair table commands of MySQL to fix the vulnerability.
Check table is used to check whether the table is damaged, and repair table is used to repair bad tables.
2. The MyISAM table is too large to be accessed
First, we can use the myisamchk command to view the MyISAM table. For example, view the admin table
Datefile lengthIndicates the current file size.
Keyfile lengthIndicates the size of the index file.
Max datefile lengthMaximum File Size
Max keyfile lengthMaximum index size
You can use the following command to expand the data file size:
Alter table table_name MAX_ROWS = 88888888 AVG_ROW_LE = 66666
Iii. Insufficient disk space for Data Directories
1. For the MyISAM storage engine
You can store data directories and index directories to different disk spaces.
2. InnoDB Storage Engine
For InnoDB Storage engine tables, because data files and index files are stored together. So they cannot be separated. When the disk space is insufficient, you can add a new data file, which is placed on a disk with sufficient space. The specific implementation is to add this file through InnoDB_data_file_path.
Innodb_data_file_path =/home/mysql/data: 10000 M;/user/mysql/data: 10000 M: autoextend
After the parameter is modified, you must restart the server to make the modification take effect.
4. Install Multiple Mysql instances on the same host
In addition to the installation directory of each Mysql, the port and socket cannot be the same.
Mysql. sock is used for communication between clients and mysql. The socket file can only be used on the local machine. The remote connection must pass through TCP/IP.
The above is the Mysql storage engine MyISAM FAQ analysis, thank you for reading.