MySQL:添加索引的时候出现错误:1114 – The table ‘xxx’ is full
在对一张大表添加字段的时候,出现如题所示的错误,具体如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
mysql> show table status like 'order_line'\G *************************** 1. row *************************** Name: order_line Engine: InnoDB Version: 10 Row_format: Dynamic Rows: 54862374 Avg_row_length: 80 Data_length: 4434427904 Max_data_length: 0 Index_length: 4449091584 Data_free: 295698432 Auto_increment: 55416183 Create_time: 2021-03-18 18:21:40 Update_time: NULL Check_time: NULL Collation: utf8_general_ci Checksum: NULL Create_options: Comment: 1 row in set (0.00 sec) mysql> mysql> desc order_line; +----------------+---------------------+------+-----+-------------------+-----------------------------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+-------------------+-----------------------------+ | aid | bigint(20) unsigned | NO | PRI | NULL | auto_increment | | ol_o_id | int(11) | NO | | NULL | | | ol_d_id | tinyint(4) | NO | | NULL | | | ol_w_id | smallint(6) | NO | | NULL | | | ol_number | tinyint(4) | NO | | NULL | | | ol_i_id | int(11) | NO | | NULL | | | ol_supply_w_id | smallint(6) | YES | MUL | NULL | | | ol_delivery_d | timestamp | NO | MUL | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP | | ol_quantity | tinyint(4) | NO | | NULL | | | ol_amount | decimal(6,2) | NO | | NULL | | | ol_dist_info | char(24) | NO | | NULL | | +----------------+---------------------+------+-----+-------------------+-----------------------------+ 11 rows in set (0.00 sec) mysql> mysql> alter table order_line add column create_time datetime not null default current_timestamp; ERROR 1114 (HY000): The table 'order_line' is full mysql> |
查看文件系统的空间:
1 2 3 4 5 6 7 8 9 |
[root@mysql-pdc0023 mysql]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 384M 3.5G 10% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 30G 26G 4.7G 85% / tmpfs 783M 0 783M 0% /run/user/1089 [root@mysql-pdc0023 mysql]# |
当前看似乎是足够的。
但是,如果在执行增加字段的命令的过程中查看的话,就会发现问题:

可以看到,确实是因为空间不够的原因,导致了MySQL抛出错误:1114 The Table ‘xxx’ is full
解法:扩容MySQL数据目录所在的挂载点(MountPoint)